Back to the library

Redact — halftone veil

Variant: Halftone veil

A spoiler cover that is printed rather than frosted: a Ben-Day dot screen over blurred text. A tap rings at the finger and the veil opens from that exact point — a radial mask growing out of the touch over 440ms on ease-out, so the hole and the tap read as one event — while the dots shrink to nothing the way a halftone lightens, tone draining before the screen is gone. Once open it stays open; nothing re-covers what the reader chose to see. Use it for spoilers, sensitive previews and content warnings. Both tweened values are registered with @property; without that it still works, it just cuts.

textprivacygesturetransitionloop

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 — halftone veil</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);
        --_veil: color-mix(in srgb, var(--oat) 55%, var(--paper));
        --_dot-ink: color-mix(in srgb, var(--clay-d) 24%, var(--_veil));

        /* Clock — 5.5s: 1% is 55ms. The veil opens from the tap in 440ms and
           stays open; nothing re-covers what the reader chose to see. The loop
           resets inside the card's fade. */
        --cycle: 5.5s;
        --t: calc(var(--cycle) / var(--speed));

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

      /* Registered so they interpolate; unregistered, the veil still opens,
         it just cuts instead of dissolving. */
      @property --_r {
        syntax: '<percentage>';
        inherits: false;
        initial-value: 0%;
      }

      @property --_dot {
        syntax: '<length>';
        inherits: false;
        initial-value: 1.8px;
      }

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

      .head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }

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

      .hint {
        font-size: 11px;
        font-weight: 600;
        color: var(--clay-d);
        animation: hint var(--t) linear infinite;
      }

      @keyframes hint {
        0%,
        15% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        18%,
        100% {
          opacity: 0;
        }
      }

      .msg {
        position: relative;
        padding: 10px 12px;
        border-radius: calc(10px * var(--round));
        background: var(--ivory);
        border: 1px solid var(--oat);
        overflow: hidden;
      }

      .txt {
        font-size: clamp(14px, 4.3vw, 15.5px);
        line-height: 1.5;
        text-wrap: balance;
        animation: txt var(--t) linear infinite;
      }

      /* The blur only matters inside the opening hole, so it lifts while the
         hole is still small instead of leaving mush behind the reveal. */
      @keyframes txt {
        0%,
        17% {
          filter: blur(6px);
          animation-timing-function: var(--ease-out);
        }
        20%,
        100% {
          filter: blur(0);
        }
      }

      /* Ben-Day dots: the veil is printed, not frosted. On reveal the dots
         shrink the way a halftone lightens — tone drops before the screen
         disappears — while a hole opens from the tap. */
      .veil {
        position: absolute;
        inset: 0;
        background-color: var(--_veil);
        background-image: radial-gradient(
          circle,
          var(--_dot-ink) var(--_dot),
          transparent calc(var(--_dot) + 0.6px)
        );
        background-size: 6px 6px;
        -webkit-mask-image: radial-gradient(
          circle at 26% 58%,
          transparent calc(var(--_r) - 22px),
          var(--slate) var(--_r)
        );
        mask-image: radial-gradient(
          circle at 26% 58%,
          transparent calc(var(--_r) - 22px),
          var(--slate) var(--_r)
        );
        animation: veil var(--t) linear infinite;
      }

      /* Origin-aware: the reveal grows out of the finger, so the hole and the
         tap are visibly the same event. Ease-out — it answers a touch. */
      @keyframes veil {
        0%,
        17% {
          --_r: 0%;
          --_dot: 1.8px;
          animation-timing-function: var(--ease-out);
        }
        25%,
        100% {
          --_r: 125%;
          --_dot: 0px;
        }
      }

      .tap {
        position: absolute;
        left: 26%;
        top: 58%;
        width: 28px;
        height: 28px;
        margin: -14px 0 0 -14px;
        border-radius: 50%;
        border: 1.5px solid var(--clay);
        opacity: 0;
        animation: tap var(--t) linear infinite;
      }

      @keyframes tap {
        0%,
        15% {
          opacity: 0;
          transform: scale(0.6);
          animation-timing-function: var(--ease-out);
        }
        16% {
          opacity: 0.9;
          transform: scale(0.7);
          animation-timing-function: var(--ease-out);
        }
        23%,
        100% {
          opacity: 0;
          transform: scale(1.7);
        }
      }

      .foot {
        font-size: 12px;
        color: var(--_muted);
      }

      @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);
        }

        /* The veil lifts and returns as a plain crossfade; no ripple, no hole. */
        .veil {
          -webkit-mask-image: none;
          mask-image: none;
          animation-name: rm-veil;
        }
        .tap {
          animation: none;
        }

        @keyframes rm-veil {
          0%,
          17% {
            opacity: 1;
          }
          21%,
          100% {
            opacity: 0;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="A message hidden under a halftone dot veil; a tap dissolves the dots outward from the touch point while the blurred text sharpens, then the veil drops back over it"
    >
      <div class="head">
        <span class="k">Spoiler · ch. 31</span>
        <span class="hint">Tap to reveal</span>
      </div>
      <div class="msg">
        <p class="txt">The narrator was the second witness all along.</p>
        <span class="veil" aria-hidden="true"></span>
        <span class="tap" aria-hidden="true"></span>
      </div>
      <p class="foot">Priya · hidden until you choose to read it</p>
    </div>
  </body>
</html>

The variant family

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