Back to the library

Stroke gesture — pattern unlock

Variant: Pattern unlock

Drawing an unlock pattern through a 3×3 grid, wrong and then right. What makes it feel like a lock rather than a doodle is that the line has two parts. The committed pattern runs straight from dot centre to dot centre whatever the finger actually did, and the live segment stretches from the last captured dot to the finger, sampled from the same 64ms table so the two never drift apart. The finger settles onto the first dot for 120ms before it moves, so touch-down reads as its own moment. A dot is captured when the finger comes within 12 units of it, and on that frame the live segment is swapped for a committed one that reaches the centre: that jump is the snap. The second attempt crosses the top row and the diagonal in single swipes, and the dots it passes over are captured on the way without the finger slowing. Nothing is judged until the finger lifts: 120ms later the whole pattern takes one colour in 160ms, and the verdict is also written underneath, because rust against olive is not something every eye can tell apart. A wrong pattern holds for 1.1s before clearing in 240ms on ease-out, long enough to see which shape was refused, and each label leaves in 90ms before the next arrives, so two messages never overlap. Under reduced motion the finger and live segment go, and the pattern still builds dot by dot. Reach for it for unlock and confirmation gestures, and any connect-the-points input.

svgline-drawinggesturecontrolerrorsuccessloop

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>Stroke gesture — pattern unlock</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 — 7.2s, two attempts (1% = 72ms). Each attempt is touch-down (120ms
           settling onto the dot before it moves), a drag that captures dots, lift, a 120ms check, then a verdict held long
           enough to read before the pattern clears in 240ms. */
        --cycle: 7.2s;
        --t: calc(var(--cycle) / var(--speed));

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

        --_ink: color-mix(in srgb, var(--slate) 80%, transparent);
        --_dot: color-mix(in oklch, var(--slate) 26%, var(--paper));
        --_touch: color-mix(in srgb, var(--slate) 13%, transparent);
        --_h-cap: color-mix(in srgb, var(--slate) 9%, transparent);
        --_h-wrong: color-mix(in srgb, var(--rust) 16%, transparent);
        --_h-right: color-mix(in srgb, var(--olive) 20%, transparent);
      }

      @property --_h {
        syntax: '<color>';
        inherits: true;
        initial-value: transparent;
      }

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

      .dots g {
        color: var(--_dot);
      }

      .halo {
        fill: var(--_h);
      }

      .dot {
        fill: currentColor;
      }

      .d0 {
        animation: d-0 var(--t) infinite;
      }

      .d1 {
        animation: d-1 var(--t) infinite;
      }

      .d2 {
        animation: d-2 var(--t) infinite;
      }

      .d3 {
        animation: d-3 var(--t) infinite;
      }

      .d4 {
        animation: d-4 var(--t) infinite;
      }

      .d6 {
        animation: d-6 var(--t) infinite;
      }

      .d7 {
        animation: d-7 var(--t) infinite;
      }

      .d8 {
        animation: d-8 var(--t) infinite;
      }

      /* Committed segments run centre to centre and are straight, whatever
         line the finger actually took. Each appears on the frame its far dot is
         captured, which is the snap: the live segment ended at the finger, a
         few units short of the dot, and the committed one ends at its centre. */
      .segs line,
      .rubber {
        fill: none;
        stroke-width: 3;
      }

      .segs line {
        stroke-linecap: round;
        opacity: 0;
      }

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

      .seg-a0 {
        animation: seg-a0 var(--t) infinite;
      }

      .seg-a1 {
        animation: seg-a1 var(--t) infinite;
      }

      .seg-a2 {
        animation: seg-a2 var(--t) infinite;
      }

      .seg-a3 {
        animation: seg-a3 var(--t) infinite;
      }

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

      .seg-b0 {
        animation: seg-b0 var(--t) infinite;
      }

      .seg-b1 {
        animation: seg-b1 var(--t) infinite;
      }

      .seg-b2 {
        animation: seg-b2 var(--t) infinite;
      }

      .seg-b3 {
        animation: seg-b3 var(--t) infinite;
      }

      .seg-b4 {
        animation: seg-b4 var(--t) infinite;
      }

      .seg-b5 {
        animation: seg-b5 var(--t) infinite;
      }

      /* The live segment: a unit line anchored at the last captured dot,
         rotated toward the finger and stretched to reach it. It is sampled from
         the same 64ms table as the finger, so the two cannot drift apart. Butt
         caps, because the far end hides under the contact disc and the near end
         sits under the dot. */
      .rubber {
        stroke: var(--_ink);
        stroke-linecap: butt;
        opacity: 0;
        animation: rubber var(--t) infinite linear;
      }

      .finger {
        fill: var(--_touch);
        opacity: 0;
        animation: finger var(--t) infinite linear;
      }

      .status text {
        font-size: 12.5px;
        font-weight: 500;
        text-anchor: middle;
        fill: var(--_ink);
        opacity: 0;
      }

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

      .status .s-wrong {
        fill: var(--rust);
        animation: s-wrong var(--t) infinite;
      }

      .status .s-right {
        fill: var(--olive);
        animation: s-right var(--t) infinite;
      }

      @keyframes d-0 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        4.17% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        6.11% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        18.61% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        20.83% {
          color: var(--rust);
          --_h: var(--_h-wrong);
        }
        33.89% {
          color: var(--rust);
          --_h: var(--_h-wrong);
          animation-timing-function: var(--ease-out);
        }
        37.22% {
          color: var(--_dot);
          --_h: transparent;
        }
        39.17% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        41.11% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        61.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        63.61% {
          color: var(--olive);
          --_h: var(--_h-right);
        }
        90.56% {
          color: var(--olive);
          --_h: var(--_h-right);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes d-1 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        43.13% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        45.07% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        61.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        63.61% {
          color: var(--olive);
          --_h: var(--_h-right);
        }
        90.56% {
          color: var(--olive);
          --_h: var(--_h-right);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes d-2 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        45.43% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        47.38% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        61.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        63.61% {
          color: var(--olive);
          --_h: var(--_h-right);
        }
        90.56% {
          color: var(--olive);
          --_h: var(--_h-right);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes d-3 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        8.14% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        10.08% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        18.61% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        20.83% {
          color: var(--rust);
          --_h: var(--_h-wrong);
        }
        33.89% {
          color: var(--rust);
          --_h: var(--_h-wrong);
          animation-timing-function: var(--ease-out);
        }
        37.22% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes d-4 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        49.81% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        51.75% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        61.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        63.61% {
          color: var(--olive);
          --_h: var(--_h-right);
        }
        90.56% {
          color: var(--olive);
          --_h: var(--_h-right);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes d-6 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        10.44% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        12.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        18.61% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        20.83% {
          color: var(--rust);
          --_h: var(--_h-wrong);
        }
        33.89% {
          color: var(--rust);
          --_h: var(--_h-wrong);
          animation-timing-function: var(--ease-out);
        }
        37.22% {
          color: var(--_dot);
          --_h: transparent;
        }
        53.18% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        55.13% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        61.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        63.61% {
          color: var(--olive);
          --_h: var(--_h-right);
        }
        90.56% {
          color: var(--olive);
          --_h: var(--_h-right);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes d-7 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        13.69% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        15.64% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        18.61% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        20.83% {
          color: var(--rust);
          --_h: var(--_h-wrong);
        }
        33.89% {
          color: var(--rust);
          --_h: var(--_h-wrong);
          animation-timing-function: var(--ease-out);
        }
        37.22% {
          color: var(--_dot);
          --_h: transparent;
        }
        56.49% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        58.43% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        61.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        63.61% {
          color: var(--olive);
          --_h: var(--_h-right);
        }
        90.56% {
          color: var(--olive);
          --_h: var(--_h-right);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes d-8 {
        0% {
          color: var(--_dot);
          --_h: transparent;
        }
        16% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        17.94% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        18.61% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        20.83% {
          color: var(--rust);
          --_h: var(--_h-wrong);
        }
        33.89% {
          color: var(--rust);
          --_h: var(--_h-wrong);
          animation-timing-function: var(--ease-out);
        }
        37.22% {
          color: var(--_dot);
          --_h: transparent;
        }
        58.79% {
          color: var(--_dot);
          --_h: transparent;
          animation-timing-function: var(--ease-out);
        }
        60.74% {
          color: var(--_ink);
          --_h: var(--_h-cap);
        }
        61.39% {
          color: var(--_ink);
          --_h: var(--_h-cap);
          animation-timing-function: ease;
        }
        63.61% {
          color: var(--olive);
          --_h: var(--_h-right);
        }
        90.56% {
          color: var(--olive);
          --_h: var(--_h-right);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          color: var(--_dot);
          --_h: transparent;
        }
        100% {
          color: var(--_dot);
          --_h: transparent;
        }
      }

      @keyframes segs-a {
        0% {
          opacity: 1;
          stroke: var(--_ink);
        }
        18.61% {
          opacity: 1;
          stroke: var(--_ink);
          animation-timing-function: ease;
        }
        20.83% {
          opacity: 1;
          stroke: var(--rust);
        }
        33.89% {
          opacity: 1;
          stroke: var(--rust);
          animation-timing-function: var(--ease-out);
        }
        37.22% {
          opacity: 0;
          stroke: var(--rust);
        }
        38.06% {
          opacity: 0;
          stroke: var(--rust);
          animation-timing-function: linear;
        }
        38.07% {
          opacity: 1;
          stroke: var(--_ink);
        }
        100% {
          opacity: 1;
          stroke: var(--_ink);
        }
      }

      @keyframes seg-a0 {
        0% {
          opacity: 0;
        }
        8.14% {
          opacity: 0;
          animation-timing-function: linear;
        }
        8.15% {
          opacity: 1;
        }
        38.06% {
          opacity: 1;
          animation-timing-function: linear;
        }
        38.07% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-a1 {
        0% {
          opacity: 0;
        }
        10.44% {
          opacity: 0;
          animation-timing-function: linear;
        }
        10.46% {
          opacity: 1;
        }
        38.06% {
          opacity: 1;
          animation-timing-function: linear;
        }
        38.07% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-a2 {
        0% {
          opacity: 0;
        }
        13.69% {
          opacity: 0;
          animation-timing-function: linear;
        }
        13.71% {
          opacity: 1;
        }
        38.06% {
          opacity: 1;
          animation-timing-function: linear;
        }
        38.07% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-a3 {
        0% {
          opacity: 0;
        }
        16% {
          opacity: 0;
          animation-timing-function: linear;
        }
        16.01% {
          opacity: 1;
        }
        38.06% {
          opacity: 1;
          animation-timing-function: linear;
        }
        38.07% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes segs-b {
        0% {
          opacity: 1;
          stroke: var(--_ink);
        }
        61.39% {
          opacity: 1;
          stroke: var(--_ink);
          animation-timing-function: ease;
        }
        63.61% {
          opacity: 1;
          stroke: var(--olive);
        }
        90.56% {
          opacity: 1;
          stroke: var(--olive);
          animation-timing-function: var(--ease-out);
        }
        93.89% {
          opacity: 0;
          stroke: var(--olive);
        }
        94.72% {
          opacity: 0;
          stroke: var(--olive);
          animation-timing-function: linear;
        }
        94.73% {
          opacity: 1;
          stroke: var(--_ink);
        }
        100% {
          opacity: 1;
          stroke: var(--_ink);
        }
      }

      @keyframes seg-b0 {
        0% {
          opacity: 0;
        }
        43.13% {
          opacity: 0;
          animation-timing-function: linear;
        }
        43.14% {
          opacity: 1;
        }
        94.72% {
          opacity: 1;
          animation-timing-function: linear;
        }
        94.73% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-b1 {
        0% {
          opacity: 0;
        }
        45.43% {
          opacity: 0;
          animation-timing-function: linear;
        }
        45.44% {
          opacity: 1;
        }
        94.72% {
          opacity: 1;
          animation-timing-function: linear;
        }
        94.73% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-b2 {
        0% {
          opacity: 0;
        }
        49.81% {
          opacity: 0;
          animation-timing-function: linear;
        }
        49.82% {
          opacity: 1;
        }
        94.72% {
          opacity: 1;
          animation-timing-function: linear;
        }
        94.73% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-b3 {
        0% {
          opacity: 0;
        }
        53.18% {
          opacity: 0;
          animation-timing-function: linear;
        }
        53.19% {
          opacity: 1;
        }
        94.72% {
          opacity: 1;
          animation-timing-function: linear;
        }
        94.73% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-b4 {
        0% {
          opacity: 0;
        }
        56.49% {
          opacity: 0;
          animation-timing-function: linear;
        }
        56.5% {
          opacity: 1;
        }
        94.72% {
          opacity: 1;
          animation-timing-function: linear;
        }
        94.73% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes seg-b5 {
        0% {
          opacity: 0;
        }
        58.79% {
          opacity: 0;
          animation-timing-function: linear;
        }
        58.8% {
          opacity: 1;
        }
        94.72% {
          opacity: 1;
          animation-timing-function: linear;
        }
        94.73% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes rubber {
        0% {
          opacity: 0;
          transform: translate(98px, 24px) rotate(0deg) scale(0, 1);
        }
        4.17% {
          opacity: 0;
          transform: translate(98px, 24px) rotate(0deg) scale(0, 1);
        }
        4.18% {
          opacity: 1;
          transform: translate(98px, 24px) rotate(0deg) scale(0, 1);
        }
        6.72% {
          opacity: 1;
          transform: translate(98px, 24px) rotate(94.4deg) scale(11.1, 1);
        }
        7.61% {
          opacity: 1;
          transform: translate(98px, 24px) rotate(94deg) scale(28.3, 1);
        }
        8.14% {
          opacity: 1;
          transform: translate(98px, 24px) rotate(93.5deg) scale(40.5, 1);
        }
        8.15% {
          opacity: 1;
          transform: translate(98px, 76px) rotate(-102.2deg) scale(11.6, 1);
        }
        8.5% {
          opacity: 1;
          transform: translate(98px, 76px) rotate(-133.5deg) scale(3.8, 1);
        }
        9.39% {
          opacity: 1;
          transform: translate(98px, 76px) rotate(-263.3deg) scale(18.9, 1);
        }
        10.28% {
          opacity: 1;
          transform: translate(98px, 76px) rotate(-268.3deg) scale(37.2, 1);
        }
        10.44% {
          opacity: 1;
          transform: translate(98px, 76px) rotate(-268.7deg) scale(40.1, 1);
        }
        10.45% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-94.4deg) scale(11.8, 1);
        }
        11.17% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-94.5deg) scale(2.1, 1);
        }
        12.06% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-4.5deg) scale(7.6, 1);
        }
        12.94% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-4.1deg) scale(23.5, 1);
        }
        13.69% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-3.5deg) scale(40.5, 1);
        }
        13.7% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(-167.8deg) scale(11.6, 1);
        }
        13.83% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(-162.8deg) scale(8.5, 1);
        }
        14.72% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(-10deg) scale(13.7, 1);
        }
        15.61% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(-2.4deg) scale(33, 1);
        }
        16% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(-1.3deg) scale(40.1, 1);
        }
        16.01% {
          opacity: 1;
          transform: translate(202px, 128px) rotate(-175.6deg) scale(11.8, 1);
        }
        16.5% {
          opacity: 1;
          transform: translate(202px, 128px) rotate(-175.5deg) scale(4.7, 1);
        }
        16.94% {
          opacity: 1;
          transform: translate(202px, 128px) rotate(0deg) scale(0, 1);
        }
        16.95% {
          opacity: 0;
          transform: translate(202px, 128px) rotate(0deg) scale(0, 1);
        }
        39.17% {
          opacity: 1;
          transform: translate(98px, 24px) rotate(0deg) scale(0, 1);
        }
        41.72% {
          opacity: 1;
          transform: translate(98px, 24px) rotate(4.4deg) scale(11.1, 1);
        }
        42.61% {
          opacity: 1;
          transform: translate(98px, 24px) rotate(4deg) scale(28.5, 1);
        }
        43.13% {
          opacity: 1;
          transform: translate(150px, 24px) rotate(167.9deg) scale(11.7, 1);
        }
        43.5% {
          opacity: 1;
          transform: translate(150px, 24px) rotate(133.5deg) scale(3.6, 1);
        }
        44.39% {
          opacity: 1;
          transform: translate(150px, 24px) rotate(6.5deg) scale(19.2, 1);
        }
        45.28% {
          opacity: 1;
          transform: translate(150px, 24px) rotate(1.7deg) scale(37.5, 1);
        }
        45.43% {
          opacity: 1;
          transform: translate(150px, 24px) rotate(1.3deg) scale(40.2, 1);
        }
        45.44% {
          opacity: 1;
          transform: translate(202px, 24px) rotate(175.6deg) scale(11.7, 1);
        }
        46.17% {
          opacity: 1;
          transform: translate(202px, 24px) rotate(175.5deg) scale(1.9, 1);
        }
        47.06% {
          opacity: 1;
          transform: translate(202px, 24px) rotate(131.8deg) scale(7.4, 1);
        }
        47.94% {
          opacity: 1;
          transform: translate(202px, 24px) rotate(131.9deg) scale(21.2, 1);
        }
        48.83% {
          opacity: 1;
          transform: translate(202px, 24px) rotate(132.2deg) scale(39.2, 1);
        }
        49.72% {
          opacity: 1;
          transform: translate(202px, 24px) rotate(132.6deg) scale(59.9, 1);
        }
        49.81% {
          opacity: 1;
          transform: translate(150px, 76px) rotate(-32.5deg) scale(11.7, 1);
        }
        50.61% {
          opacity: 1;
          transform: translate(150px, 76px) rotate(117.7deg) scale(8.6, 1);
        }
        51.5% {
          opacity: 1;
          transform: translate(150px, 76px) rotate(130.9deg) scale(29.5, 1);
        }
        52.39% {
          opacity: 1;
          transform: translate(150px, 76px) rotate(133.4deg) scale(48.2, 1);
        }
        53.18% {
          opacity: 1;
          transform: translate(150px, 76px) rotate(134.4deg) scale(61.7, 1);
        }
        53.19% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-41.9deg) scale(11.7, 1);
        }
        53.28% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-41.8deg) scale(10.4, 1);
        }
        54.17% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(-41.8deg) scale(0.2, 1);
        }
        55.06% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(4.4deg) scale(10.7, 1);
        }
        55.94% {
          opacity: 1;
          transform: translate(98px, 128px) rotate(4deg) scale(28, 1);
        }
        56.49% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(167.8deg) scale(11.6, 1);
        }
        56.83% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(139.5deg) scale(4, 1);
        }
        57.72% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(6.8deg) scale(18.7, 1);
        }
        58.61% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(1.7deg) scale(37.1, 1);
        }
        58.79% {
          opacity: 1;
          transform: translate(150px, 128px) rotate(1.3deg) scale(40.2, 1);
        }
        58.8% {
          opacity: 1;
          transform: translate(202px, 128px) rotate(175.6deg) scale(11.7, 1);
        }
        59.5% {
          opacity: 1;
          transform: translate(202px, 128px) rotate(175.5deg) scale(2.1, 1);
        }
        59.72% {
          opacity: 1;
          transform: translate(202px, 128px) rotate(0deg) scale(0, 1);
        }
        59.73% {
          opacity: 0;
          transform: translate(202px, 128px) rotate(0deg) scale(0, 1);
        }
        100% {
          opacity: 0;
          transform: translate(98px, 24px) rotate(0deg) scale(0, 1);
        }
      }

      @keyframes finger {
        0% {
          opacity: 0;
          transform: translate(98px, 24px) scale(1.25);
        }
        4.15% {
          opacity: 0;
          transform: translate(98px, 24px) scale(1.25);
        }
        4.17% {
          opacity: 0;
          transform: translate(98px, 24px) scale(1.25);
          animation-timing-function: var(--ease-out);
        }
        5.83% {
          opacity: 1;
          transform: translate(98px, 24px) scale(1);
        }
        6.72% {
          opacity: 1;
          transform: translate(97.1px, 35px) scale(1);
        }
        7.61% {
          opacity: 1;
          transform: translate(96px, 52.3px) scale(1);
        }
        8.14% {
          opacity: 1;
          transform: translate(95.6px, 64.5px) scale(1);
        }
        8.15% {
          opacity: 1;
          transform: translate(95.6px, 64.7px) scale(1);
        }
        8.5% {
          opacity: 1;
          transform: translate(95.4px, 73.3px) scale(1);
        }
        9.39% {
          opacity: 1;
          transform: translate(95.8px, 94.7px) scale(1);
        }
        10.28% {
          opacity: 1;
          transform: translate(96.9px, 113.2px) scale(1);
        }
        10.44% {
          opacity: 1;
          transform: translate(97.1px, 116.1px) scale(1);
        }
        10.45% {
          opacity: 1;
          transform: translate(97.1px, 116.2px) scale(1);
        }
        11.17% {
          opacity: 1;
          transform: translate(97.8px, 125.9px) scale(1);
        }
        12.06% {
          opacity: 1;
          transform: translate(105.6px, 127.4px) scale(1);
        }
        12.94% {
          opacity: 1;
          transform: translate(121.5px, 126.3px) scale(1);
        }
        13.69% {
          opacity: 1;
          transform: translate(138.5px, 125.6px) scale(1);
        }
        13.7% {
          opacity: 1;
          transform: translate(138.7px, 125.6px) scale(1);
        }
        13.83% {
          opacity: 1;
          transform: translate(141.8px, 125.5px) scale(1);
        }
        14.72% {
          opacity: 1;
          transform: translate(163.5px, 125.6px) scale(1);
        }
        15.61% {
          opacity: 1;
          transform: translate(183px, 126.6px) scale(1);
        }
        16% {
          opacity: 1;
          transform: translate(190.1px, 127.1px) scale(1);
        }
        16.01% {
          opacity: 1;
          transform: translate(190.2px, 127.1px) scale(1);
        }
        16.5% {
          opacity: 1;
          transform: translate(197.4px, 127.6px) scale(1);
        }
        16.94% {
          opacity: 1;
          transform: translate(202px, 128px) scale(1);
          animation-timing-function: var(--ease-out);
        }
        19.17% {
          opacity: 0;
          transform: translate(202px, 128px) scale(1.2);
        }
        39.15% {
          opacity: 0;
          transform: translate(98px, 24px) scale(1.25);
        }
        39.17% {
          opacity: 0;
          transform: translate(98px, 24px) scale(1.25);
          animation-timing-function: var(--ease-out);
        }
        40.83% {
          opacity: 1;
          transform: translate(98px, 24px) scale(1);
        }
        41.72% {
          opacity: 1;
          transform: translate(109.1px, 24.9px) scale(1);
        }
        42.61% {
          opacity: 1;
          transform: translate(126.4px, 26px) scale(1);
        }
        43.13% {
          opacity: 1;
          transform: translate(138.6px, 26.4px) scale(1);
        }
        43.5% {
          opacity: 1;
          transform: translate(147.5px, 26.6px) scale(1);
        }
        44.39% {
          opacity: 1;
          transform: translate(169.1px, 26.2px) scale(1);
        }
        45.28% {
          opacity: 1;
          transform: translate(187.5px, 25.1px) scale(1);
        }
        45.43% {
          opacity: 1;
          transform: translate(190.1px, 24.9px) scale(1);
        }
        45.44% {
          opacity: 1;
          transform: translate(190.3px, 24.9px) scale(1);
        }
        46.17% {
          opacity: 1;
          transform: translate(200.1px, 24.1px) scale(1);
        }
        47.06% {
          opacity: 1;
          transform: translate(197.1px, 29.5px) scale(1);
        }
        47.94% {
          opacity: 1;
          transform: translate(187.8px, 39.8px) scale(1);
        }
        48.83% {
          opacity: 1;
          transform: translate(175.7px, 53.1px) scale(1);
        }
        49.72% {
          opacity: 1;
          transform: translate(161.4px, 68.1px) scale(1);
        }
        49.81% {
          opacity: 1;
          transform: translate(159.9px, 69.7px) scale(1);
        }
        50.61% {
          opacity: 1;
          transform: translate(146px, 83.6px) scale(1);
        }
        51.5% {
          opacity: 1;
          transform: translate(130.7px, 98.3px) scale(1);
        }
        52.39% {
          opacity: 1;
          transform: translate(116.9px, 111px) scale(1);
        }
        53.18% {
          opacity: 1;
          transform: translate(106.8px, 120.1px) scale(1);
        }
        53.19% {
          opacity: 1;
          transform: translate(106.7px, 120.2px) scale(1);
        }
        53.28% {
          opacity: 1;
          transform: translate(105.8px, 121.1px) scale(1);
        }
        54.17% {
          opacity: 1;
          transform: translate(98.1px, 127.9px) scale(1);
        }
        55.06% {
          opacity: 1;
          transform: translate(108.7px, 128.8px) scale(1);
        }
        55.94% {
          opacity: 1;
          transform: translate(125.9px, 129.9px) scale(1);
        }
        56.49% {
          opacity: 1;
          transform: translate(138.7px, 130.4px) scale(1);
        }
        56.83% {
          opacity: 1;
          transform: translate(147px, 130.6px) scale(1);
        }
        57.72% {
          opacity: 1;
          transform: translate(168.5px, 130.2px) scale(1);
        }
        58.61% {
          opacity: 1;
          transform: translate(187.1px, 129.1px) scale(1);
        }
        58.79% {
          opacity: 1;
          transform: translate(190.2px, 128.9px) scale(1);
        }
        58.8% {
          opacity: 1;
          transform: translate(190.4px, 128.9px) scale(1);
        }
        59.5% {
          opacity: 1;
          transform: translate(199.9px, 128.2px) scale(1);
        }
        59.72% {
          opacity: 1;
          transform: translate(202px, 128px) scale(1);
          animation-timing-function: var(--ease-out);
        }
        61.94% {
          opacity: 0;
          transform: translate(202px, 128px) scale(1.2);
        }
        100% {
          opacity: 0;
          transform: translate(98px, 24px) scale(1.25);
        }
      }

      @keyframes s-idle {
        0% {
          opacity: 1;
        }
        18.61% {
          opacity: 1;
          animation-timing-function: ease;
        }
        19.86% {
          opacity: 0;
        }
        35.14% {
          opacity: 0;
          animation-timing-function: ease;
        }
        37.08% {
          opacity: 1;
        }
        61.39% {
          opacity: 1;
          animation-timing-function: ease;
        }
        62.64% {
          opacity: 0;
        }
        91.81% {
          opacity: 0;
          animation-timing-function: ease;
        }
        93.75% {
          opacity: 1;
        }
        100% {
          opacity: 1;
        }
      }

      @keyframes s-wrong {
        0% {
          opacity: 0;
        }
        19.86% {
          opacity: 0;
          animation-timing-function: ease;
        }
        21.81% {
          opacity: 1;
        }
        33.89% {
          opacity: 1;
          animation-timing-function: ease;
        }
        35.14% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @keyframes s-right {
        0% {
          opacity: 0;
        }
        62.64% {
          opacity: 0;
          animation-timing-function: ease;
        }
        64.58% {
          opacity: 1;
        }
        90.56% {
          opacity: 1;
          animation-timing-function: ease;
        }
        91.81% {
          opacity: 0;
        }
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* Same score, 1.6x slower. The finger and the live segment are the
           travel, so they go; the pattern still assembles dot by dot on the
           capture frames, and the verdict still lands in words and colour. */
        :root {
          --t: calc(var(--cycle) * 1.6 / var(--speed));
        }

        .finger,
        .rubber {
          display: none;
        }
      }
    </style>
  </head>
  <body>
    <div class="card">
      <svg
        viewBox="0 0 300 182"
        role="img"
        aria-label="A finger draws an L through the left column and bottom row of a three by three dot grid; it is the wrong pattern and turns rust. A second attempt draws a Z, capturing the middle dots it passes straight through, and the pattern turns olive with the word Unlocked"
      >
        <g class="dots">
          <g class="d0">
            <circle class="halo" cx="98" cy="24" r="14" />
            <circle class="dot" cx="98" cy="24" r="4.5" />
          </g>
          <g class="d1">
            <circle class="halo" cx="150" cy="24" r="14" />
            <circle class="dot" cx="150" cy="24" r="4.5" />
          </g>
          <g class="d2">
            <circle class="halo" cx="202" cy="24" r="14" />
            <circle class="dot" cx="202" cy="24" r="4.5" />
          </g>
          <g class="d3">
            <circle class="halo" cx="98" cy="76" r="14" />
            <circle class="dot" cx="98" cy="76" r="4.5" />
          </g>
          <g class="d4">
            <circle class="halo" cx="150" cy="76" r="14" />
            <circle class="dot" cx="150" cy="76" r="4.5" />
          </g>
          <g class="d5">
            <circle class="halo" cx="202" cy="76" r="14" />
            <circle class="dot" cx="202" cy="76" r="4.5" />
          </g>
          <g class="d6">
            <circle class="halo" cx="98" cy="128" r="14" />
            <circle class="dot" cx="98" cy="128" r="4.5" />
          </g>
          <g class="d7">
            <circle class="halo" cx="150" cy="128" r="14" />
            <circle class="dot" cx="150" cy="128" r="4.5" />
          </g>
          <g class="d8">
            <circle class="halo" cx="202" cy="128" r="14" />
            <circle class="dot" cx="202" cy="128" r="4.5" />
          </g>
        </g>
        <g class="segs segs-a">
          <line class="seg-a0" x1="98" y1="24" x2="98" y2="76" />
          <line class="seg-a1" x1="98" y1="76" x2="98" y2="128" />
          <line class="seg-a2" x1="98" y1="128" x2="150" y2="128" />
          <line class="seg-a3" x1="150" y1="128" x2="202" y2="128" />
        </g>
        <g class="segs segs-b">
          <line class="seg-b0" x1="98" y1="24" x2="150" y2="24" />
          <line class="seg-b1" x1="150" y1="24" x2="202" y2="24" />
          <line class="seg-b2" x1="202" y1="24" x2="150" y2="76" />
          <line class="seg-b3" x1="150" y1="76" x2="98" y2="128" />
          <line class="seg-b4" x1="98" y1="128" x2="150" y2="128" />
          <line class="seg-b5" x1="150" y1="128" x2="202" y2="128" />
        </g>
        <line class="rubber" x1="0" y1="0" x2="1" y2="0" />
        <circle class="finger" cx="0" cy="0" r="12" />
        <g class="status">
          <text class="s-idle" x="150" y="166">Draw your unlock pattern</text>
          <text class="s-wrong" x="150" y="166">Wrong pattern — try again</text>
          <text class="s-right" x="150" y="166">Unlocked</text>
        </g>
      </svg>
    </div>
  </body>
</html>