Back to the library

Settle — watermark seal

Variant: Watermark

Stream processing in one card. Events stack into three one-minute windows, some out of order — a 12:00 event lands while 12:01 is already filling — and a watermark trails behind wall-clock time. That lag is the allowed lateness, and the piece is about where it ends: when the watermark crosses a boundary the window takes a lid and a tint, and its label flips from open to final. A straggler that arrives after the seal lands on the lid, holds in rust for 480ms so the refusal is legible, then slides off as it fades — routed aside, not destroyed — and the late count ticks up. Every arrival, seal and the watermark itself runs off one registered clock, so nothing can fire out of order. Use it to explain windowed aggregates, or as a live status for one.

datainfrastructureprogressdiagramloop

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>Settle — watermark seal</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)
        );

        --_muted: color-mix(in srgb, var(--slate) 52%, transparent);
        --_sealed: color-mix(in srgb, var(--oat) 45%, var(--paper));

        /* Clock — 8s: one registered number, --_now, runs 0→100 across it
           (1 unit is 80ms). Every arrival, seal and the watermark itself is a
           function of that one number, so nothing can drift out of order. */
        --cycle: 8s;
        --t: calc(var(--cycle) / var(--speed));

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

        /* How far a block falls on arrival; reduced motion zeroes it. */
        --_drop: -22px;
        /* How far a refused block slides toward the side output as it goes. */
        --_exit: 16px;
      }

      /* Without @property (Safari < 16.4, Firefox < 128) --_now cannot tween
         and flips once at mid-loop: the card still reads, it just cuts. */
      @property --_now {
        syntax: '<number>';
        inherits: true;
        initial-value: 0;
      }

      * {
        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);
      }

      .card {
        width: min(288px, calc(100vw - 40px));
        display: grid;
        gap: 8px;
        animation:
          tick var(--t) linear infinite,
          frame var(--t) linear infinite;
      }

      .label {
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--_muted);
      }

      /* Windows sit edge to edge so their boundaries are exact thirds — the
         watermark crossing 33.3% is the same event as window one closing. */
      .lanes {
        position: relative;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        margin-top: 22px;
        height: 86px;
        border: 1px solid var(--oat);
        border-radius: calc(6px * var(--round));
        background: var(--paper);
      }

      .win {
        position: relative;
        --_s: clamp(0, (var(--_now) - var(--_seal)) / 3, 1);
      }

      .win + .win {
        border-left: 1px solid var(--oat);
      }

      /* Sealing is a tint and a lid, eased in over 240ms by the same clock:
         the window stops being a bin and becomes a number. */
      .win::before {
        content: '';
        position: absolute;
        inset: 0;
        background: var(--_sealed);
        opacity: var(--_s);
      }

      .win::after {
        content: '';
        position: absolute;
        left: 6px;
        right: 6px;
        top: -1px;
        height: 2px;
        border-radius: 999px;
        background: var(--clay-d);
        opacity: calc(var(--_s) * 0.6);
      }

      /* Each block computes its own ease-out from --_now: q runs 1→0 over
         4 units (320ms) after its arrival, and the fall is q³ — a cubic
         ease-out written by hand, because one clock drives everything. */
      .blk {
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: calc(5px + var(--_i) * 13px);
        height: 10px;
        border-radius: calc(2px * var(--round));
        background: var(--clay);
        --_q: clamp(0, 1 - (var(--_now) - var(--_at)) / 4, 1);
        opacity: calc(1 - var(--_q) * var(--_q));
        transform: translateY(calc(var(--_q) * var(--_q) * var(--_q) * var(--_drop)));
      }

      /* Arrives after its window sealed: it lands on the lid, holds 480ms in
         rust so the refusal is legible, then slides 16px off the lid as it
         fades (240ms, quadratic ease-out) — routed aside, not destroyed. */
      .blk.late {
        bottom: auto;
        top: -13px;
        background: var(--rust);
        --_gone: clamp(0, (var(--_now) - var(--_at) - 6) / 3, 1);
        opacity: calc((1 - var(--_q) * var(--_q)) * (1 - var(--_gone)));
        transform: translate(
          calc(var(--_gone) * (2 - var(--_gone)) * var(--_exit)),
          calc(var(--_q) * var(--_q) * var(--_q) * var(--_drop))
        );
      }

      /* The watermark trails wall-clock on purpose — that lag is the window
         of allowed lateness. It runs at 0.925 per unit so it crosses the
         first boundary at 36 and the second at 72. */
      .wm {
        position: absolute;
        top: -8px;
        bottom: -8px;
        left: 0;
        width: 100%;
        pointer-events: none;
        transform: translateX(calc(min(var(--_now) * 0.925, 84) * 1%));
      }

      .wm::before {
        content: '';
        position: absolute;
        left: -1px;
        top: 0;
        bottom: 0;
        width: 2px;
        border-radius: 999px;
        background: var(--clay-d);
      }

      .times {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        font-size: 11px;
        font-variant-numeric: tabular-nums;
        text-align: center;
        color: var(--_muted);
      }

      .times b {
        display: block;
        color: var(--slate);
        font-weight: 600;
      }

      .sw {
        display: grid;
      }

      .sw > span {
        grid-area: 1 / 1;
      }

      .open {
        opacity: calc(1 - var(--_s));
      }

      .final {
        opacity: var(--_s);
        color: var(--slate);
      }

      .times > span {
        --_s: clamp(0, (var(--_now) - var(--_seal)) / 3, 1);
      }

      .key {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 4px 12px;
        font-size: 11px;
        color: var(--_muted);
      }

      .key > span {
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }

      .key i {
        width: 2px;
        height: 11px;
        border-radius: 999px;
        background: var(--clay-d);
      }

      .late-n {
        font-variant-numeric: tabular-nums;
      }

      .late-n b {
        color: var(--rust);
        font-weight: 600;
      }

      .late-n .n0 {
        opacity: calc(1 - clamp(0, (var(--_now) - 61) / 2, 1));
      }

      .late-n .n1 {
        opacity: clamp(0, (var(--_now) - 61) / 2, 1);
      }

      @keyframes tick {
        from {
          --_now: 0;
        }
        to {
          --_now: 100;
        }
      }

      /* --_now wraps from 100 to 0 inside the dark window, so the reset of
         every block, seal and the watermark is never on screen. */
      @keyframes frame {
        0% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        3%,
        92% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        97%,
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* Blocks arrive as fades instead of falls; the watermark keeps
           moving because its position is the data. Slowed 1.6x. */
        :root {
          --_drop: 0px;
          --_exit: 0px;
        }

        .card {
          animation-duration: calc(var(--t) * 1.6);
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="Three one-minute event-time windows filling with events, some out of order; a watermark line trails behind and seals each window as it passes, marking it final; an event that arrives after its window sealed is turned away and counted as late"
    >
      <span class="label">Event-time windows</span>
      <div class="lanes">
        <div class="win" style="--_seal: 36">
          <span class="blk" style="--_i: 0; --_at: 6"></span>
          <span class="blk" style="--_i: 1; --_at: 11"></span>
          <span class="blk" style="--_i: 2; --_at: 17"></span>
          <span class="blk" style="--_i: 3; --_at: 26"></span>
          <span class="blk late" style="--_i: 0; --_at: 52"></span>
        </div>
        <div class="win" style="--_seal: 72">
          <span class="blk" style="--_i: 0; --_at: 14"></span>
          <span class="blk" style="--_i: 1; --_at: 21"></span>
          <span class="blk" style="--_i: 2; --_at: 31"></span>
          <span class="blk" style="--_i: 3; --_at: 40"></span>
          <span class="blk" style="--_i: 4; --_at: 47"></span>
          <span class="blk" style="--_i: 5; --_at: 60"></span>
        </div>
        <div class="win" style="--_seal: 999">
          <span class="blk" style="--_i: 0; --_at: 44"></span>
          <span class="blk" style="--_i: 1; --_at: 53"></span>
          <span class="blk" style="--_i: 2; --_at: 64"></span>
          <span class="blk" style="--_i: 3; --_at: 70"></span>
          <span class="blk" style="--_i: 4; --_at: 79"></span>
          <span class="blk" style="--_i: 5; --_at: 86"></span>
        </div>
        <div class="wm"></div>
      </div>
      <div class="times">
        <span style="--_seal: 36"
          ><b>12:00</b
          ><span class="sw"
            ><span class="open">open</span><span class="final">final</span></span
          ></span
        >
        <span style="--_seal: 72"
          ><b>12:01</b
          ><span class="sw"
            ><span class="open">open</span><span class="final">final</span></span
          ></span
        >
        <span style="--_seal: 999"
          ><b>12:02</b
          ><span class="sw"
            ><span class="open">open</span><span class="final">final</span></span
          ></span
        >
      </div>
      <div class="key">
        <span><i></i>Watermark</span>
        <span class="late-n"
          >Too late: <b class="sw"><span class="n0">0</span><span class="n1">1</span></b></span
        >
      </div>
    </div>
  </body>
</html>

The variant family

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