Back to the library

Wire — splice a node in

Variant: Splice

Dropping a node onto an existing edge to insert it, then lifting it back out — the shortcut that saves deleting a link and drawing two. The node travels both ways on ease-in-out, 4% larger and shadowed only while it is in the air. The edge gives way before the drop: as the node’s leading edge reaches the line, the two halves part to 13 units short of where it will sit, and rings mark where its ports will land, so the insertion is visible while it can still be abandoned. The halves stay grey while parted, the family’s rule being that nothing takes clay until it is committed. On the drop frame the rings close, the node’s own ports fade in, and each half reaches into them in 160ms and turns clay. Lifting it out runs backwards, with the ports leaving on the lift rather than the landing, since a node in the air has already let go of both sides; the halves go grey and heal in the middle only once it has cleared the line. The chain readout changes when the wiring does, never mid-flight. Reach for it in flow and pipeline editors, audio and shader graphs, and any list of steps that accepts drag-in insertion.

svgline-drawingdiagramgesturelayoutloop

The source

A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Wire — splice a node in</title>
    <style>
      :root {
        /* Neutrals — fixed, never remixed. */
        --ivory: #faf9f5;
        --paper: #ffffff;
        --oat: #e3dacc;
        --slate: #141413;

        /* Knobs — the remix API. A knob exists iff declared here and used below. */
        --hue: 38.8;
        --lift: 0;
        --chroma: 1;
        --round: 1;
        --speed: 1;

        /* Accents — derived from the knobs with the family's offsets baked in,
           so one hue roll moves them together. Defaults reproduce the original hex. */
        --clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
        --clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
        --olive: oklch(
          calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
        );
        --rust: oklch(
          calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
        );

        /* Clock — 6.4s, the one wire variant on a longer score because it plays
           both directions (1% = 64ms): splice in, hold, lift out, heal. */
        --cycle: 6.4s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

        --_ink: color-mix(in srgb, var(--slate) 80%, transparent);
        --_wire: color-mix(in oklch, var(--slate) 38%, var(--paper));
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        min-height: 100vh;
        display: grid;
        place-items: center;
        padding: clamp(10px, 3vw, 28px);
        background: var(--ivory);
        font-family:
          system-ui,
          -apple-system,
          'Segoe UI',
          Roboto,
          sans-serif;
      }

      .card {
        width: min(380px, 92vw);
        border: 1px solid var(--oat);
        border-radius: calc(14px * var(--round));
        background: var(--paper);
      }

      .card svg {
        display: block;
        width: 100%;
        height: auto;
      }

      /* Nodes are pills, so their radius stays literal and never takes --round. */
      .node rect {
        fill: var(--ivory);
        stroke: var(--oat);
        stroke-width: 1;
      }

      .node text,
      .status text {
        font-size: 12.5px;
        font-weight: 500;
        fill: var(--_ink);
      }

      .node text {
        text-anchor: middle;
      }

      .half {
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-dasharray: 100 200;
        animation: half var(--t) infinite;
      }

      /* The edge is two halves meeting under the node's landing spot, each
         pulling toward its own port. The edge gives way before the drop: as
         the node's leading edge reaches the line, both halves part to 13
         units short of where the node will sit, so the insertion is visible
         while it can still be abandoned. They stay neutral wire while parted
         — the family's rule is grey until committed — and take hold after:
         on the drop frame each half reaches into the node's new port in
         160ms and takes clay. Lifting the node out returns them to wire on
         the lift, and they heal in the middle once it has cleared the line. */
      @keyframes half {
        0%,
        14.5% {
          stroke: var(--_wire);
          stroke-dashoffset: 0;
          animation-timing-function: var(--ease-out);
        }
        18.5%,
        27% {
          stroke: var(--_wire);
          stroke-dashoffset: 72;
          animation-timing-function: var(--ease-out);
        }
        29.5%,
        58% {
          stroke: var(--clay);
          stroke-dashoffset: 52.94;
          animation-timing-function: var(--ease-out);
        }
        60.5%,
        66% {
          stroke: var(--_wire);
          stroke-dashoffset: 72;
          animation-timing-function: var(--ease-out);
        }
        70.5%,
        100% {
          stroke: var(--_wire);
          stroke-dashoffset: 0;
        }
      }

      /* Where the node's ports will land, ringed while it is in the air — the
         same aiming rings as the connect variant — and closing onto the ports
         on the drop. */
      .halo {
        fill: none;
        stroke: var(--clay);
        stroke-width: 1.25;
        opacity: 0;
        transform-box: fill-box;
        transform-origin: center;
        animation: halo var(--t) infinite;
      }

      @keyframes halo {
        0%,
        14.5% {
          opacity: 0;
          transform: scale(0.8);
          animation-timing-function: var(--ease-out);
        }
        18.5%,
        27% {
          opacity: 0.6;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        29.5% {
          opacity: 1;
          transform: scale(0.62);
          animation-timing-function: ease;
        }
        33%,
        100% {
          opacity: 0;
          transform: scale(0.62);
        }
      }

      .port {
        fill: var(--_wire);
        stroke: var(--paper);
        stroke-width: 1.5;
        transform-box: fill-box;
        transform-origin: center;
      }

      /* The new node's ports exist only while it is wired in: they fade in on
         the drop and leave on the lift, because a lifted node has already let
         go of both edges. */
      .port.new {
        opacity: 0;
        animation: new-port var(--t) infinite;
      }

      @keyframes new-port {
        0%,
        27% {
          opacity: 0;
          transform: scale(0.6);
          animation-timing-function: var(--ease-out);
        }
        30%,
        58% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        60.5%,
        100% {
          opacity: 0;
          transform: scale(0.6);
        }
      }

      /* The node travels as a whole on ease-in-out — it is on screen going
         from A to B both ways. The parked spot is 64 units below the line. */
      .carry {
        animation: carry var(--t) infinite;
      }

      @keyframes carry {
        0%,
        7.5% {
          transform: translateY(64px);
          animation-timing-function: var(--ease-in-out);
        }
        23.75%,
        60.5% {
          transform: translateY(0);
          animation-timing-function: var(--ease-in-out);
        }
        76.75%,
        100% {
          transform: translateY(64px);
        }
      }

      /* Lifted means 4% larger with a shadow under it, landing is both
         undone in 160ms on ease-out; only a node in the air casts one. */
      .lift {
        transform-box: fill-box;
        transform-origin: center;
        animation: lift var(--t) infinite;
      }

      @keyframes lift {
        0%,
        5% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        7.5%,
        27% {
          transform: scale(1.04);
          animation-timing-function: var(--ease-out);
        }
        29.5%,
        58% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        60.5%,
        76.75% {
          transform: scale(1.04);
          animation-timing-function: var(--ease-out);
        }
        79.25%,
        100% {
          transform: scale(1);
        }
      }

      .shadow {
        fill: var(--slate);
        opacity: 0;
        animation: shadow var(--t) infinite;
      }

      @keyframes shadow {
        0%,
        5% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        7.5%,
        27% {
          opacity: 0.14;
          animation-timing-function: var(--ease-out);
        }
        29.5%,
        58% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        60.5%,
        76.75% {
          opacity: 0.14;
          animation-timing-function: var(--ease-out);
        }
        79.25%,
        100% {
          opacity: 0;
        }
      }

      .pointer {
        opacity: 0;
        animation: pointer var(--t) infinite;
      }

      .pointer path {
        fill: var(--slate);
        stroke: var(--paper);
        stroke-width: 1.25;
        stroke-linejoin: round;
      }

      /* Pressed for as long as the node is held, scaled about the tip. */
      .press {
        transform-origin: 178px 69px;
        animation: press var(--t) infinite;
      }

      @keyframes press {
        0%,
        5% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        7.5%,
        27% {
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        29.5%,
        58% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        60.5%,
        76.75% {
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        79.25%,
        100% {
          transform: scale(1);
        }
      }

      @keyframes pointer {
        0%,
        2% {
          opacity: 0;
          animation-timing-function: ease;
        }
        5%,
        29.5% {
          opacity: 1;
          animation-timing-function: ease;
        }
        33%,
        55% {
          opacity: 0;
          animation-timing-function: ease;
        }
        58%,
        79.25% {
          opacity: 1;
          animation-timing-function: ease;
        }
        83%,
        100% {
          opacity: 0;
        }
      }

      /* The readout spells the chain, and changes when the wiring does: on
         the drop, and when the halves heal — not on the lift, while the edge
         is still open. */
      .s-pair {
        animation: s-pair var(--t) infinite;
      }
      .s-chain {
        animation: s-chain var(--t) infinite;
      }

      @keyframes s-pair {
        0%,
        29.5% {
          opacity: 1;
          animation-timing-function: ease;
        }
        31%,
        71% {
          opacity: 0;
          animation-timing-function: ease;
        }
        73%,
        100% {
          opacity: 1;
        }
      }

      @keyframes s-chain {
        0%,
        31.5% {
          opacity: 0;
          animation-timing-function: ease;
        }
        33.5%,
        69% {
          opacity: 1;
          animation-timing-function: ease;
        }
        70.5%,
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* Half speed, and the node never travels: it fades out where it was
           parked and fades in on the line once the edge has parted, swapping places while it is
           invisible. The parting, the new ports and the readout keep their
           beats, so the edge still visibly gives way and heals. */
        :root {
          --t: calc(var(--cycle) * 2 / var(--speed));
        }

        .lift,
        .shadow,
        .press,
        .pointer {
          animation: none;
        }

        .carry {
          animation-name: carry-calm;
        }

        @keyframes carry-calm {
          0%,
          7.5% {
            opacity: 1;
            transform: translateY(64px);
            animation-timing-function: ease;
          }
          15% {
            opacity: 0;
            transform: translateY(64px);
          }
          15.01%,
          21% {
            opacity: 0;
            transform: translateY(0);
            animation-timing-function: ease;
          }
          27%,
          60.5% {
            opacity: 1;
            transform: translateY(0);
            animation-timing-function: ease;
          }
          66% {
            opacity: 0;
            transform: translateY(0);
          }
          66.01% {
            opacity: 0;
            transform: translateY(64px);
            animation-timing-function: ease;
          }
          76.75%,
          100% {
            opacity: 1;
            transform: translateY(64px);
          }
        }
      }
    </style>
  </head>
  <body>
    <div class="card">
      <svg
        viewBox="0 0 300 160"
        role="img"
        aria-label="An Assess node is picked up from below an existing wire between Intake and Benefits; as it nears the wire the wire parts and turns clay, and when the node is dropped onto it two new ports appear and the halves connect into them, making Intake to Assess to Benefits; then the node is lifted back out and the wire heals in the middle"
      >
        <defs>
          <filter id="soft" x="-20%" y="-50%" width="140%" height="200%">
            <feGaussianBlur stdDeviation="3" />
          </filter>
        </defs>

        <g class="status">
          <text class="s-pair" x="14" y="28">Intake → Benefits</text>
          <text class="s-chain" x="14" y="28">Intake → Assess → Benefits</text>
        </g>

        <g class="node">
          <rect x="12" y="44" width="70" height="32" rx="16" />
          <text x="47" y="64.5">Intake</text>
        </g>
        <g class="node">
          <rect x="218" y="44" width="70" height="32" rx="16" />
          <text x="253" y="64.5">Benefits</text>
        </g>

        <path class="half" pathLength="100" d="M 82 60 H 150" />
        <path class="half" pathLength="100" d="M 218 60 H 150" />

        <circle class="port" cx="82" cy="60" r="4" />
        <circle class="port" cx="218" cy="60" r="4" />

        <g class="carry">
          <g class="lift">
            <rect
              class="shadow"
              x="116"
              y="49"
              width="68"
              height="30"
              rx="15"
              filter="url(#soft)"
            />
            <g class="node">
              <rect x="114" y="44" width="72" height="32" rx="16" />
              <text x="150" y="64.5">Assess</text>
            </g>
          </g>
          <circle class="port new" cx="114" cy="60" r="4" />
          <circle class="port new" cx="186" cy="60" r="4" />
          <g class="pointer">
            <g class="press">
              <path
                transform="translate(178 69)"
                d="M0 0 L0 13.5 L3.6 10.2 L6.2 15.6 L8.6 14.5 L6 9.2 L10.8 9.2 Z"
              />
            </g>
          </g>
        </g>

        <circle class="halo" cx="114" cy="60" r="9" />
        <circle class="halo" cx="186" cy="60" r="9" />
      </svg>
    </div>
  </body>
</html>

The variant family

Same idea, one axis moved. Compare them side by side before you commit.