Redact — peek, then re-mask
Variant: Peek
A masked secret you can look at, briefly. Tapping the eye takes a 4% press, the slash retracts, and the recovery code unmasks left to right on steps(14) — one step per glyph, because a pixel wipe leaves half-drawn characters that are neither hidden nor readable. A clay hairline then drains under the field for three seconds, linear because it is a clock and an eased timer lies about time left. When it runs out the code re-masks in a single 120ms crossfade: concealing is one act, and a stepped exit would leave half a secret on screen. Reach for it on recovery codes, passwords and tokens — anywhere showing a value is fine but leaving it shown is not.
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 — peek, then re-mask</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 — 6s: 1% is 60ms. The reveal steps across 14 glyphs in 330ms;
the window then stays open for 3s and closes in one 120ms beat. */
--cycle: 6s;
--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);
}
.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 {
position: relative;
display: flex;
align-items: center;
gap: 8px;
height: 40px;
padding: 0 6px 0 12px;
border-radius: calc(8px * var(--round));
background: var(--_field);
border: 1px solid var(--oat);
overflow: hidden;
}
/* Monospace, so a bullet and the glyph it stands for share one cell and
the two layers line up column for column. */
.secret {
position: relative;
flex: 1;
display: grid;
font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
font-size: clamp(13px, 4vw, 15px);
letter-spacing: 0.04em;
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
.secret span {
grid-area: 1 / 1;
justify-self: start;
}
/* Revealed by glyph, never by pixel: steps(14) is one step per
character, because half a character is neither secret nor readable. */
.plain {
animation: plain var(--t) linear infinite;
}
.mask {
color: var(--_muted);
animation: mask var(--t) linear infinite;
}
@keyframes plain {
0%,
14% {
clip-path: inset(0 100% 0 0);
opacity: 1;
animation-timing-function: steps(14, end);
}
19.5% {
clip-path: inset(0 0 0 0);
}
70% {
clip-path: inset(0 0 0 0);
opacity: 1;
animation-timing-function: var(--ease-out);
}
72%,
100% {
clip-path: inset(0 0 0 0);
opacity: 0;
}
}
/* Closing is one act, not a sweep: a re-mask that stepped back across
the string would leave half a secret on screen for a third of a second. */
@keyframes mask {
0%,
14% {
clip-path: inset(0 0 0 0);
opacity: 1;
animation-timing-function: steps(14, end);
}
19.5%,
70% {
clip-path: inset(0 0 0 100%);
opacity: 1;
}
70.01% {
clip-path: inset(0 0 0 0);
opacity: 0;
animation-timing-function: var(--ease-out);
}
72%,
100% {
clip-path: inset(0 0 0 0);
opacity: 1;
}
}
.eye {
flex: none;
display: grid;
place-items: center;
width: 30px;
height: 30px;
border-radius: calc(6px * var(--round));
color: var(--_muted);
animation: press var(--t) linear infinite;
}
.eye svg {
width: 18px;
height: 18px;
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
/* A 4% press on a 240ms round trip — the tap, nothing more. */
@keyframes press {
0%,
11% {
transform: scale(1);
background: transparent;
color: var(--_muted);
animation-timing-function: var(--ease-out);
}
12.5% {
transform: scale(0.96);
background: var(--oat);
color: var(--slate);
}
15% {
transform: scale(1);
background: transparent;
color: var(--slate);
}
70% {
color: var(--slate);
animation-timing-function: var(--ease-out);
}
72%,
100% {
transform: scale(1);
background: transparent;
color: var(--_muted);
}
}
/* The slash is the state: it retracts as the eye opens, redraws as it shuts. */
.slash {
stroke-dasharray: 22;
animation: slash var(--t) linear infinite;
}
@keyframes slash {
0%,
13% {
stroke-dashoffset: 0;
animation-timing-function: var(--ease-out);
}
16.5%,
70% {
stroke-dashoffset: 22;
animation-timing-function: var(--ease-out);
}
73%,
100% {
stroke-dashoffset: 0;
}
}
/* The open window is a clock, so it drains linearly — an eased timer
would lie about how much time is left. */
.timer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 2px;
background: var(--clay);
transform-origin: left;
animation: timer var(--t) linear infinite;
}
@keyframes timer {
0%,
19.5% {
transform: scaleX(1);
opacity: 0;
}
20% {
transform: scaleX(1);
opacity: 1;
}
70% {
transform: scaleX(0);
opacity: 1;
}
70.01%,
100% {
transform: scaleX(0);
opacity: 0;
}
}
.note {
display: grid;
font-size: 12px;
color: var(--_muted);
}
.note span {
grid-area: 1 / 1;
}
.n-hid {
animation: n-hid var(--t) linear infinite;
}
.n-vis {
animation: n-vis var(--t) linear infinite;
}
/* Back to back, never overlapping: two different sentences at half
opacity on top of each other read as neither. */
@keyframes n-hid {
0%,
15% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
16.5%,
71.5% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
73.5%,
100% {
opacity: 1;
}
}
@keyframes n-vis {
0%,
16.5% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
18.5%,
70% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
71.5%,
100% {
opacity: 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);
}
/* The secret still opens and shuts on the same beats, but as one
crossfade instead of a glyph-by-glyph step, and the eye does not press. */
.plain {
animation-name: rm-plain;
}
.mask {
animation-name: rm-mask;
}
.eye {
animation: none;
}
@keyframes rm-plain {
0%,
14% {
opacity: 0;
}
17%,
70% {
opacity: 1;
}
72%,
100% {
opacity: 0;
}
}
@keyframes rm-mask {
0%,
14% {
opacity: 1;
}
17%,
70% {
opacity: 0;
}
72%,
100% {
opacity: 1;
}
}
}
</style>
</head>
<body>
<div
class="card"
role="img"
aria-label="A masked recovery code: tapping the eye reveals it one character at a time, a timer bar drains under the field, and the code re-masks all at once when it runs out"
>
<span class="k">Recovery code</span>
<div class="field">
<span class="secret">
<span class="mask">••••-••••-••••</span>
<span class="plain">4F7K-Q92M-XC3B</span>
</span>
<span class="eye">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z" />
<circle cx="12" cy="12" r="2.8" />
<path class="slash" d="M4.5 4.5 19.5 19.5" />
</svg>
</span>
<span class="timer"></span>
</div>
<p class="note">
<span class="n-hid">Hidden · tap the eye to show</span>
<span class="n-vis">Hides again when the bar runs out</span>
</p>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.