Overview
Decipher-style text reveal where the destination phrase stays as live DOM text and a decorative aria-hidden cipher overlay ticks through symbol-like glyphs then clears via clip-path. The base text is selectable + copyable + readable throughout; only the overlay animates.
When to use it
Reach for scramble reveals on terminal-style product surfaces, decoding metaphors (search results, AI inference), and hero string entrances. Skip it for utility chrome — the cipher pattern is loud enough to feel marketing-y. Skip it for content over 30 characters; the per-cell tick budget becomes too long.
How it works
Two stacked DOM layers: a real text node holding the destination string, and an aria-hidden overlay positioned absolutely on top. The overlay swaps characters every ~30–60ms from a glyph pool (Katakana, custom symbols) via requestAnimationFrame or a timed JS loop. The overlay clears left-to-right via clip-path: inset(0 100% 0 0) animating to inset(0 0 0 0) over the reveal duration. Once the clip clears, the overlay text matches the underlying text and you can remove the overlay (or just leave it — the user sees real text only).
Production gotchas
The clip-path direction must travel from right to left from the user’s perspective so the cipher “decodes” toward final state — reversing the inset direction breaks the metaphor. The cipher glyph pool affects the “feel”: pure ASCII reads flat, while mixing Katakana + symbols reads Matrix-coded. Avoid Emoji in the pool — they have variable widths and the cipher overlay jitters. Set font-variant-numeric: tabular-nums on the overlay if the destination contains digits, or the swap animation reflows.
Accessibility
The decorative overlay must be aria-hidden="true" so screen readers ignore the cipher glyphs. The underlying real text is announced normally on page load. Under prefers-reduced-motion: reduce skip the cipher swap and clip-path animation entirely — the real text is already there; no transformation needed. Verify focus order if any controls live inside the scrambled region.
References