Back to the library

Redact — shown once

Variant: Shown once

The create-a-key moment, where the whole value is visible exactly once. A clay warning says to copy it now; the copy press swaps the clipboard for an olive tick, and only then does the mask sweep the secret middle on steps(8), in reading order, while the button dims — there is nothing left to copy. Half the bullets drop out and the tail slides 4ch left on a 385ms ease-in-out (it is already on screen, so it moves rather than arrives), tightening the string to its fingerprint: prefix and last four, the parts a person needs to tell keys apart. Use it for API keys, webhook secrets and access tokens.

textprivacysuccessclip-pathloop

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>Redact — shown once</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);
        --_field: color-mix(in srgb, var(--oat) 28%, var(--paper));

        /* Clock — 7s: 1% is 70ms. Copy lands at 14%, the mask sweeps the
           secret at 34%, and the string tightens to its fingerprint at 44%. */
        --cycle: 7s;
        --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);
      }

      * {
        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(300px, calc(100vw - 32px));
        padding: 14px 16px 15px;
        display: grid;
        gap: 9px;
        border-radius: calc(12px * var(--round));
        background: var(--paper);
        border: 1px solid var(--oat);
        animation: card var(--t) linear infinite;
      }

      /* The reset hides in a dark window at the wrap. */
      @keyframes card {
        0% {
          opacity: 0;
        }
        2.5% {
          opacity: 1;
        }
        95.5% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        100% {
          opacity: 0;
        }
      }

      .k {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--_muted);
      }

      .field {
        display: flex;
        align-items: center;
        gap: 8px;
        height: 40px;
        padding: 0 5px 0 12px;
        border-radius: calc(8px * var(--round));
        background: var(--_field);
        border: 1px solid var(--oat);
      }

      /* Monospace with no tracking, so 1ch is exactly one glyph and the tail
         can slide by a whole number of characters. */
      .key {
        flex: 1;
        display: flex;
        min-width: 0;
        font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
        font-size: clamp(12px, 3.8vw, 13.5px);
        white-space: nowrap;
      }

      .pre {
        color: var(--_muted);
      }

      .mid {
        display: grid;
      }

      .mid > span {
        grid-area: 1 / 1;
        display: flex;
      }

      /* Masked by glyph in reading order: steps(8), one per character. */
      .m-plain {
        animation: m-plain var(--t) linear infinite;
      }

      .m-mask {
        color: var(--_muted);
        animation: m-mask var(--t) linear infinite;
      }

      @keyframes m-plain {
        0%,
        34% {
          clip-path: inset(0 0 0 0);
          animation-timing-function: steps(8, end);
        }
        37.5%,
        100% {
          clip-path: inset(0 0 0 100%);
        }
      }

      @keyframes m-mask {
        0%,
        34% {
          clip-path: inset(0 100% 0 0);
          animation-timing-function: steps(8, end);
        }
        37.5%,
        100% {
          clip-path: inset(0 0 0 0);
        }
      }

      .m-mask i {
        font-style: normal;
      }

      /* Four bullets are enough to say "something was here"; eight just
         spend width on nothing. */
      .m-mask i:nth-child(n + 5) {
        animation: drop var(--t) linear infinite;
      }

      @keyframes drop {
        0%,
        43% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        45%,
        100% {
          opacity: 0;
        }
      }

      /* The tail is on screen and moving A to B, so ease-in-out; it closes the
         gap rather than arriving. */
      .tail {
        animation: tail var(--t) linear infinite;
      }

      @keyframes tail {
        0%,
        45% {
          transform: translateX(0);
          animation-timing-function: var(--ease-in-out);
        }
        50.5%,
        100% {
          transform: translateX(-4ch);
        }
      }

      .copy {
        flex: none;
        display: grid;
        place-items: center;
        width: 30px;
        height: 30px;
        border-radius: calc(6px * var(--round));
        animation: press var(--t) linear infinite;
      }

      .copy svg {
        grid-area: 1 / 1;
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      @keyframes press {
        0%,
        12.5% {
          transform: scale(1);
          background: transparent;
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        14% {
          transform: scale(0.96);
          background: var(--oat);
        }
        16.5% {
          transform: scale(1);
          background: transparent;
        }
        32% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        35%,
        100% {
          transform: scale(1);
          background: transparent;
          opacity: 0.35;
        }
      }

      .i-copy {
        color: var(--slate);
        animation: i-copy var(--t) linear infinite;
      }

      .i-done {
        color: var(--olive);
        animation: i-done var(--t) linear infinite;
      }

      @keyframes i-copy {
        0%,
        14% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        16%,
        32% {
          opacity: 0;
          transform: scale(0.8);
          animation-timing-function: var(--ease-out);
        }
        35%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
      }

      @keyframes i-done {
        0%,
        14% {
          opacity: 0;
          transform: scale(0.8);
          animation-timing-function: var(--ease-out);
        }
        16.5%,
        32% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        34%,
        100% {
          opacity: 0;
          transform: scale(0.8);
        }
      }

      .note {
        display: grid;
        font-size: 12px;
        line-height: 1.4;
      }

      .note span {
        grid-area: 1 / 1;
      }

      .n-warn {
        color: var(--clay-d);
        font-weight: 600;
        animation: n-out var(--t) linear infinite;
      }

      .n-kept {
        color: var(--_muted);
        animation: n-in var(--t) linear infinite;
      }

      @keyframes n-out {
        0%,
        33% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        35.5%,
        100% {
          opacity: 0;
        }
      }

      /* The new line rises as the tail settles, so it lands describing the
         string that is actually on screen. */
      @keyframes n-in {
        0%,
        47% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        51%,
        100% {
          opacity: 1;
          transform: translateY(0);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* One shared 1.6x clock keeps every part in phase. */
        .card,
        .card *,
        .card *::before,
        .card *::after {
          animation-duration: calc(var(--t) * 1.6);
        }

        /* Same beats: the secret crossfades to bullets in one go, the tail
           jumps instead of sliding, and nothing presses or rises. */
        .m-plain {
          animation-name: rm-out;
        }
        .m-mask {
          animation-name: rm-in;
        }
        .tail {
          animation-name: rm-tail;
        }
        .copy {
          animation-name: rm-dim;
        }
        .i-copy {
          animation-name: rm-copy;
        }
        .i-done {
          animation-name: rm-done;
        }
        .n-kept {
          animation-name: rm-kept;
        }
        .i-copy,
        .i-done,
        .n-kept {
          transform: none;
        }

        @keyframes rm-copy {
          0%,
          14% {
            opacity: 1;
          }
          16%,
          32% {
            opacity: 0;
          }
          35%,
          100% {
            opacity: 1;
          }
        }
        @keyframes rm-done {
          0%,
          14% {
            opacity: 0;
          }
          16%,
          32% {
            opacity: 1;
          }
          34%,
          100% {
            opacity: 0;
          }
        }
        @keyframes rm-kept {
          0%,
          47% {
            opacity: 0;
          }
          50%,
          100% {
            opacity: 1;
          }
        }

        @keyframes rm-out {
          0%,
          34% {
            opacity: 1;
          }
          37%,
          100% {
            opacity: 0;
          }
        }
        @keyframes rm-in {
          0%,
          34% {
            opacity: 0;
          }
          37%,
          100% {
            opacity: 1;
          }
        }
        @keyframes rm-tail {
          0%,
          47% {
            transform: translateX(0);
          }
          47.01%,
          100% {
            transform: translateX(-4ch);
          }
        }
        @keyframes rm-dim {
          0%,
          32% {
            opacity: 1;
          }
          35%,
          100% {
            opacity: 0.35;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="A newly created API key shown in full with a warning to copy it now; after it is copied, the secret middle is masked character by character and the string tightens to its prefix and last four characters"
    >
      <span class="k">New API key</span>
      <div class="field">
        <span class="key">
          <span class="pre">sk-live-</span>
          <span class="mid">
            <span class="m-plain">7Hq2mN8v</span>
            <span class="m-mask"
              ><i>•</i><i>•</i><i>•</i><i>•</i><i>•</i><i>•</i><i>•</i><i>•</i></span
            >
          </span>
          <span class="tail">Rt4X</span>
        </span>
        <span class="copy">
          <svg class="i-copy" viewBox="0 0 24 24" aria-hidden="true">
            <rect x="8" y="8" width="12" height="12" rx="2.5" />
            <path
              d="M16 8V6.5A2.5 2.5 0 0 0 13.5 4h-7A2.5 2.5 0 0 0 4 6.5v7A2.5 2.5 0 0 0 6.5 16H8"
            />
          </svg>
          <svg class="i-done" viewBox="0 0 24 24" aria-hidden="true">
            <path d="M5 12.5 10 17.5 19 7" />
          </svg>
        </span>
      </div>
      <p class="note">
        <span class="n-warn">Copy it now — it won’t be shown again</span>
        <span class="n-kept">Only the prefix and last four are kept</span>
      </p>
    </div>
  </body>
</html>

The variant family

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