Back to the library

Wire — trace upstream

Variant: Trace

Clicking a node in a graph to ask where it comes from. The lit strokes draw from the selected end back toward the sources, the direction of the question rather than the direction of the data, and they travel one generation per 240ms hop whatever the edge’s length: Clinic’s long edge and Assess’s short one land on Benefits’ parents on the same frame, because depth is what is being shown. Each hop starts softly off its node and settles long into the next, so the nodes read as waypoints the trace passed through, and each outlines on the frame it is reached. Everything outside the lineage steps back to 30% rather than disappearing, since lineage is read against the rest of the graph. Switching to Housing redraws Intake → Assess from scratch even though both selections share it: the lineage was recomputed, and an edge that stayed lit would claim it had not been. Reach for it in dependency graphs, data lineage, build and DAG views, and anywhere "what feeds this?" is the question.

svgline-drawingdiagramemphasisdataloop

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 — trace upstream</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 (1% = 64ms): two selections, each traced in 240ms hops,
           each held long enough to read the lineage it lit. */
        --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);
        /* The hop: a soft start off each node and a long settle into the next,
           so every node on the way reads as a waypoint the trace passed
           through, not a bead on one continuous line. */
        --ease-accent: cubic-bezier(0.5, 0, 0.1, 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;
      }

      .node rect {
        animation: var(--_k, none) var(--t) infinite;
      }

      .base,
      .lit {
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
      }

      .base {
        stroke: var(--_wire);
      }

      /* Lit strokes draw from the selected end back toward the sources — the
         direction of the question, not the direction of the data. A negative
         offset pushes the dash off the far end of the path, and walking it to
         zero grows the stroke from there backwards. Opacity rises with it, so
         under reduced motion, with the dash removed, the same keyframes still
         fade each hop in on its beat. */
      .lit {
        stroke: var(--clay);
        stroke-dasharray: 100 200;
        stroke-dashoffset: -100;
        opacity: 0;
      }

      /* One hop per generation, whatever its length: Clinic's long edge and
         Assess's short one both arrive at Benefits' parents on the same frame,
         because depth is the thing being shown, not distance. */
      .lit.e3,
      .lit.e4 {
        animation: lit-a var(--t) infinite;
      }
      .lit.e2 {
        animation: lit-b var(--t) infinite;
      }
      .lit.e1 {
        animation: lit-shared var(--t) infinite;
      }

      @keyframes lit-a {
        0%,
        7.5% {
          stroke-dashoffset: -100;
          opacity: 0;
          animation-timing-function: var(--ease-accent);
        }
        11.25%,
        42% {
          stroke-dashoffset: 0;
          opacity: 1;
          animation-timing-function: ease;
        }
        44% {
          stroke-dashoffset: 0;
          opacity: 0;
        }
        44.01%,
        100% {
          stroke-dashoffset: -100;
          opacity: 0;
        }
      }

      @keyframes lit-b {
        0%,
        46.5% {
          stroke-dashoffset: -100;
          opacity: 0;
          animation-timing-function: var(--ease-accent);
        }
        50.25%,
        84% {
          stroke-dashoffset: 0;
          opacity: 1;
          animation-timing-function: ease;
        }
        87% {
          stroke-dashoffset: 0;
          opacity: 0;
        }
        87.01%,
        100% {
          stroke-dashoffset: -100;
          opacity: 0;
        }
      }

      /* Intake → Assess is upstream of both selections, and it still goes
         dark between them and redraws: the lineage was recomputed for the new
         node, and an edge that stayed lit would claim it had not been. */
      @keyframes lit-shared {
        0%,
        11.25% {
          stroke-dashoffset: -100;
          opacity: 0;
          animation-timing-function: var(--ease-accent);
        }
        15%,
        42% {
          stroke-dashoffset: 0;
          opacity: 1;
          animation-timing-function: ease;
        }
        44% {
          stroke-dashoffset: 0;
          opacity: 0;
        }
        44.01%,
        50.25% {
          stroke-dashoffset: -100;
          opacity: 0;
          animation-timing-function: var(--ease-accent);
        }
        54%,
        84% {
          stroke-dashoffset: 0;
          opacity: 1;
          animation-timing-function: ease;
        }
        87% {
          stroke-dashoffset: 0;
          opacity: 0;
        }
        87.01%,
        100% {
          stroke-dashoffset: -100;
          opacity: 0;
        }
      }

      /* What is not upstream steps back to 30% rather than vanishing: the
         lineage is read against the rest of the graph, not instead of it. */
      .dim-a {
        animation: dim-a var(--t) infinite;
      }
      .dim-b {
        animation: dim-b var(--t) infinite;
      }

      @keyframes dim-a {
        0%,
        5% {
          opacity: 1;
          animation-timing-function: ease;
        }
        8.75%,
        42% {
          opacity: 0.3;
          animation-timing-function: ease;
        }
        45%,
        100% {
          opacity: 1;
        }
      }

      @keyframes dim-b {
        0%,
        42% {
          opacity: 1;
          animation-timing-function: ease;
        }
        45%,
        84% {
          opacity: 0.3;
          animation-timing-function: ease;
        }
        87%,
        100% {
          opacity: 1;
        }
      }

      /* A node outlines in clay on the frame the trace reaches it. */
      .n-assess {
        --_k: n-assess;
      }
      .n-clinic {
        --_k: n-clinic;
      }
      .n-intake {
        --_k: n-intake;
      }

      @keyframes n-assess {
        0%,
        11.25% {
          stroke: var(--oat);
          animation-timing-function: ease;
        }
        13.25%,
        42% {
          stroke: var(--clay);
          animation-timing-function: ease;
        }
        44%,
        50.25% {
          stroke: var(--oat);
          animation-timing-function: ease;
        }
        52.25%,
        84% {
          stroke: var(--clay);
          animation-timing-function: ease;
        }
        87%,
        100% {
          stroke: var(--oat);
        }
      }

      @keyframes n-clinic {
        0%,
        11.25% {
          stroke: var(--oat);
          animation-timing-function: ease;
        }
        13.25%,
        42% {
          stroke: var(--clay);
          animation-timing-function: ease;
        }
        44%,
        100% {
          stroke: var(--oat);
        }
      }

      @keyframes n-intake {
        0%,
        15% {
          stroke: var(--oat);
          animation-timing-function: ease;
        }
        17%,
        42% {
          stroke: var(--clay);
          animation-timing-function: ease;
        }
        44%,
        54% {
          stroke: var(--oat);
          animation-timing-function: ease;
        }
        56%,
        84% {
          stroke: var(--clay);
          animation-timing-function: ease;
        }
        87%,
        100% {
          stroke: var(--oat);
        }
      }

      .ring {
        fill: none;
        stroke: var(--clay);
        stroke-width: 1.5;
        opacity: 0;
        transform-box: fill-box;
        transform-origin: center;
      }

      .ring.a {
        animation: ring-a var(--t) infinite;
      }
      .ring.b {
        animation: ring-b var(--t) infinite;
      }

      /* Selection settles in from 3% large in 160ms; it leaves in 128ms,
         faster than it came, and the next one waits for it. */
      @keyframes ring-a {
        0%,
        5% {
          opacity: 0;
          transform: scale(1.03);
          animation-timing-function: var(--ease-out);
        }
        7.5%,
        42% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: ease;
        }
        44%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

      @keyframes ring-b {
        0%,
        44% {
          opacity: 0;
          transform: scale(1.03);
          animation-timing-function: var(--ease-out);
        }
        46.5%,
        84% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: ease;
        }
        86%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

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

      .s-idle {
        animation: s-idle var(--t) infinite;
      }
      .s-a {
        animation: s-a var(--t) infinite;
      }
      .s-b {
        animation: s-b var(--t) infinite;
      }

      @keyframes s-idle {
        0%,
        5% {
          opacity: 1;
          animation-timing-function: ease;
        }
        6.5%,
        87% {
          opacity: 0;
          animation-timing-function: ease;
        }
        89%,
        100% {
          opacity: 1;
        }
      }

      @keyframes s-a {
        0%,
        7% {
          opacity: 0;
          animation-timing-function: ease;
        }
        9%,
        42% {
          opacity: 1;
          animation-timing-function: ease;
        }
        43.5%,
        100% {
          opacity: 0;
        }
      }

      @keyframes s-b {
        0%,
        44% {
          opacity: 0;
          animation-timing-function: ease;
        }
        46%,
        84% {
          opacity: 1;
          animation-timing-function: ease;
        }
        85.5%,
        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;
      }

      /* A click is the cause of each selection: a 96ms press lands just
         before the ring does, and the move between nodes is on-screen travel,
         so it glides on ease-in-out. */
      @keyframes pointer {
        0% {
          opacity: 0;
          transform: translate(286px, 136px) scale(1);
          animation-timing-function: var(--ease-out);
        }
        3% {
          opacity: 1;
          transform: translate(280px, 128px) scale(1);
          animation-timing-function: var(--ease-out);
        }
        4.5% {
          transform: translate(280px, 128px) scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        6%,
        39% {
          transform: translate(280px, 128px) scale(1);
          animation-timing-function: var(--ease-in-out);
        }
        42.5% {
          transform: translate(280px, 48px) scale(1);
          animation-timing-function: var(--ease-out);
        }
        44% {
          transform: translate(280px, 48px) scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        45.5%,
        47% {
          opacity: 1;
          transform: translate(280px, 48px) scale(1);
          animation-timing-function: var(--ease-out);
        }
        50%,
        100% {
          opacity: 0;
          transform: translate(286px, 56px) scale(1);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* Half speed, and no stroke travels: with the dash gone each hop
           fades in whole on its own beat, so the trace still walks back one
           generation at a time. */
        :root {
          --t: calc(var(--cycle) * 2 / var(--speed));
        }

        .lit {
          stroke-dasharray: none;
        }

        .pointer {
          animation: none;
        }
      }
    </style>
  </head>
  <body>
    <div class="card">
      <svg
        viewBox="0 0 300 160"
        role="img"
        aria-label="A five-node graph: Intake feeds Assess, Assess feeds Housing and Benefits, and Clinic also feeds Benefits. A pointer clicks Benefits, which dims Housing and lights its upstream edges hop by hop back to Assess, Clinic and then Intake; then Housing is selected and the trace redraws back through Assess to Intake while the rest dims"
      >
        <path class="base e1" d="M 74 40 C 96 40, 96 80, 118 80" />
        <path class="base e2 dim-a" d="M 182 80 C 204 80, 204 40, 226 40" />
        <path class="base e3 dim-b" d="M 182 80 C 204 80, 204 120, 226 120" />
        <path class="base e4 dim-b" d="M 74 120 H 226" />

        <path class="lit e1" pathLength="100" d="M 74 40 C 96 40, 96 80, 118 80" />
        <path class="lit e2" pathLength="100" d="M 182 80 C 204 80, 204 40, 226 40" />
        <path class="lit e3" pathLength="100" d="M 182 80 C 204 80, 204 120, 226 120" />
        <path class="lit e4" pathLength="100" d="M 74 120 H 226" />

        <g class="node n-intake">
          <rect x="10" y="27" width="64" height="26" rx="13" />
          <text x="42" y="44.5">Intake</text>
        </g>
        <g class="node n-clinic dim-b">
          <rect x="10" y="107" width="64" height="26" rx="13" />
          <text x="42" y="124.5">Clinic</text>
        </g>
        <g class="node n-assess">
          <rect x="118" y="67" width="64" height="26" rx="13" />
          <text x="150" y="84.5">Assess</text>
        </g>
        <g class="node dim-a">
          <rect x="226" y="27" width="64" height="26" rx="13" />
          <text x="258" y="44.5">Housing</text>
        </g>
        <g class="node dim-b">
          <rect x="226" y="107" width="64" height="26" rx="13" />
          <text x="258" y="124.5">Benefits</text>
        </g>

        <rect class="b ring" x="222" y="23" width="72" height="34" rx="17" />
        <rect class="a ring" x="222" y="103" width="72" height="34" rx="17" />

        <circle class="port" cx="74" cy="40" r="3.5" />
        <circle class="port" cx="118" cy="80" r="3.5" />
        <circle class="port" cx="182" cy="80" r="3.5" />
        <circle class="port dim-b" cx="74" cy="120" r="3.5" />
        <circle class="port dim-a" cx="226" cy="40" r="3.5" />
        <circle class="port dim-b" cx="226" cy="120" r="3.5" />

        <g class="pointer">
          <path 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 class="status">
          <text class="s-idle" x="10" y="153">Select a node to trace it</text>
          <text class="s-a" x="10" y="153">Upstream of Benefits</text>
          <text class="s-b" x="10" y="153">Upstream of Housing</text>
        </g>
      </svg>
    </div>
  </body>
</html>

The variant family

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