Back to the library

Delineate — the gap is drawn as a gap

Variant: Data gap

A transect plotted honestly, which mostly means plotting where there is nothing. A small pen marker rides the axis at one linear rate, since the x axis is distance along the ground, and the measured line follows it; each sample point lands as the pen passes, because the points are the data and the line between them is only how you read it. At the last sample before the gap the line stops and a hairline drops to the axis, but the pen keeps going at the same speed with nothing to draw. Across those 88 units it is the only thing moving, so missing data takes exactly as long as measured data and the gap has a visible length. When samples resume, the second hairline lands and the line picks back up. Only after both sides are complete is the gap bridged. The bridge is never drawn by the pen: it is inferred, not measured, so it fades in once as a lighter dotted line, labelled "no samples · interpolated". Reach for it in any series that can have holes, such as monitoring outages, sensor dropouts or missed survey days.

svgline-drawingchartdataloop

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>Delineate — the gap is drawn as a gap</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;
        --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 — 7.2s. The pen crosses the transect in half of it at one
           rate, gap included: 88 units of no data take as long as 88 units
           of data, so the silence has a length. */
        --cycle: 7.2s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
      }

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

      body {
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: var(--ivory);
        font-family:
          system-ui,
          -apple-system,
          'Segoe UI',
          Roboto,
          sans-serif;
        color: var(--slate);
      }

      .sheet {
        width: min(340px, 90vw);
        height: auto;
        display: block;
      }

      .axis {
        stroke: var(--oat);
        stroke-width: 1;
      }

      .caption {
        fill: var(--slate);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.08em;
        opacity: 0.55;
      }

      .plot {
        animation: plot-clear var(--t) var(--ease-out) infinite;
      }

      /* Measured line is drawn by the pen, linear: the x axis is distance
         along the ground, and a pen that eased would be claiming the samples
         were bunched. */
      .trace {
        fill: none;
        stroke: var(--olive);
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-dasharray: 100 200;
        stroke-dashoffset: 100;
        animation: trace-one var(--t) linear infinite;
      }

      .trace.two {
        animation-name: trace-two;
      }

      /* Every sample lands as the pen passes it — the vertices are the data,
         the line between them is only the reading. */
      .sample {
        fill: var(--paper);
        stroke: var(--olive);
        stroke-width: 1.5;
        transform-box: fill-box;
        transform-origin: center;
        opacity: 0;
        transform: scale(0.6);
        animation: s1 var(--t) var(--ease-out) infinite;
      }

      .sample.n2 {
        animation-name: s2;
      }
      .sample.n3 {
        animation-name: s3;
      }
      .sample.n4 {
        animation-name: s4;
      }
      .sample.n5 {
        animation-name: s5;
      }
      .sample.n6 {
        animation-name: s6;
      }
      .sample.n7 {
        animation-name: s7;
      }
      .sample.n8 {
        animation-name: s8;
      }

      /* The pen lifts at the last sample and drops a solid hairline to the axis
         where it stopped; the second lands only when data resumes. Both edges of
         the gap are claims made at the moment they became true. */
      .tick {
        stroke: var(--slate);
        stroke-width: 1;
        opacity: 0;
        animation: tick-left var(--t) var(--ease-out) infinite;
      }

      .tick.right {
        animation-name: tick-right;
      }

      /* The bridge is never drawn by the pen. It is inferred, not measured,
         so it is declared in one beat — dotted, lighter, and only after the
         measured line is complete on both sides of it. */
      .bridge {
        fill: none;
        stroke: var(--olive);
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-dasharray: 0.1 5;
        opacity: 0;
        animation: bridge-in var(--t) var(--ease-out) infinite;
      }

      /* The pen itself, riding the axis at the one rate everything else is
         timed off. It is what makes the gap a length: across 128–216 it is
         the only thing moving, and it does not speed up. */
      .pen {
        stroke: var(--clay-d);
        stroke-width: 2;
        stroke-linecap: round;
        opacity: 0;
        animation: pen-travel var(--t) linear infinite;
      }

      .gap-note {
        fill: var(--clay-d);
        font-size: 12px;
        opacity: 0;
        animation: note-in var(--t) var(--ease-out) infinite;
      }

      @keyframes trace-one {
        0%,
        5% {
          stroke-dashoffset: 100;
        }
        25%,
        100% {
          stroke-dashoffset: 0;
        }
      }

      @keyframes trace-two {
        0%,
        45% {
          stroke-dashoffset: 100;
        }
        55%,
        100% {
          stroke-dashoffset: 0;
        }
      }

      @keyframes s1 {
        0%,
        5% {
          opacity: 0;
          transform: scale(0.6);
        }
        7.5%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }
      @keyframes s2 {
        0%,
        9.8% {
          opacity: 0;
          transform: scale(0.6);
        }
        12.3%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }
      @keyframes s3 {
        0%,
        15% {
          opacity: 0;
          transform: scale(0.6);
        }
        17.5%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }
      @keyframes s4 {
        0%,
        20.3% {
          opacity: 0;
          transform: scale(0.6);
        }
        22.8%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }
      @keyframes s5 {
        0%,
        25% {
          opacity: 0;
          transform: scale(0.6);
        }
        27.5%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }
      @keyframes s6 {
        0%,
        45% {
          opacity: 0;
          transform: scale(0.6);
        }
        47.5%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }
      @keyframes s7 {
        0%,
        50.3% {
          opacity: 0;
          transform: scale(0.6);
        }
        52.8%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }
      @keyframes s8 {
        0%,
        55% {
          opacity: 0;
          transform: scale(0.6);
        }
        57.5%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }

      @keyframes pen-travel {
        0%,
        2% {
          opacity: 0;
          transform: translateX(0);
        }
        5% {
          opacity: 1;
          transform: translateX(0);
        }
        55% {
          opacity: 1;
          transform: translateX(220px);
        }
        59%,
        100% {
          opacity: 0;
          transform: translateX(220px);
        }
      }

      @keyframes tick-left {
        0%,
        25% {
          opacity: 0;
        }
        27%,
        100% {
          opacity: 0.3;
        }
      }

      @keyframes tick-right {
        0%,
        45% {
          opacity: 0;
        }
        47%,
        100% {
          opacity: 0.3;
        }
      }

      @keyframes bridge-in {
        0%,
        60% {
          opacity: 0;
        }
        65%,
        100% {
          opacity: 0.6;
        }
      }

      @keyframes note-in {
        0%,
        63% {
          opacity: 0;
        }
        68%,
        100% {
          opacity: 1;
        }
      }

      @keyframes plot-clear {
        0%,
        88% {
          opacity: 1;
        }
        95%,
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The order is the argument — measured, gap, measured, then the
           inference — so it plays at half rate rather than appearing whole. */
        .plot,
        .trace,
        .sample,
        .tick,
        .bridge,
        .pen,
        .gap-note {
          animation-duration: calc(var(--t) * 2);
        }
      }
    </style>
  </head>
  <body>
    <svg
      class="sheet"
      viewBox="0 0 300 180"
      role="img"
      aria-label="A transect profile of groundwater level drawn left to right, with a pen marker travelling along the axis at a constant rate. Five sample points are plotted with a solid line through them, then the pen lifts where no samples exist, marking each edge of the gap with a hairline while the marker keeps travelling across it, and resumes for three more samples. Only after both sides are drawn does a lighter dotted line bridge the gap, labelled no samples, interpolated."
    >
      <text class="caption" x="30" y="40">TRANSECT A · WATER LEVEL</text>
      <line class="axis" x1="30" y1="140" x2="270" y2="140" />

      <g class="plot">
        <path class="trace" pathLength="100" d="M40 96 L62 88 L84 100 L106 86 L128 92" />
        <path class="trace two" pathLength="100" d="M216 118 L238 104 L260 110" />

        <line class="tick" x1="128" y1="98" x2="128" y2="140" />
        <line class="tick right" x1="216" y1="124" x2="216" y2="140" />

        <path class="bridge" d="M128 92 L216 118" />
        <line class="pen" x1="40" y1="135" x2="40" y2="145" />

        <circle class="sample" cx="40" cy="96" r="3" />
        <circle class="sample n2" cx="62" cy="88" r="3" />
        <circle class="sample n3" cx="84" cy="100" r="3" />
        <circle class="sample n4" cx="106" cy="86" r="3" />
        <circle class="sample n5" cx="128" cy="92" r="3" />
        <circle class="sample n6" cx="216" cy="118" r="3" />
        <circle class="sample n7" cx="238" cy="104" r="3" />
        <circle class="sample n8" cx="260" cy="110" r="3" />

        <text class="gap-note" x="172" y="164" text-anchor="middle">no samples · interpolated</text>
      </g>
    </svg>
  </body>
</html>