Live preview · fully interactive
The prompt
Build a binary decode headline. ## Look Monospace headline, clamp(28px, 5vw, 60px), tracking -0.04em, color #f2f2f7 on #08080d. Final text is “Decode the brief”. ## Behavior Every 70ms, lock one more character from the left and keep the rest as alternating 0 and 1. When finished, hold 1200ms and repeat. ## Design tokens - Text #f2f2f7; page #08080d. ## Motion - Step 70ms. Hold 1200ms. Total reveal about 1.2s for 16 characters. ## Constraints - Single self-contained HTML file. No libraries. - Honor prefers-reduced-motion: reduce by skipping the loop and leaving a readable static frame - Readable at 390px width with no horizontal page scroll
The code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
background: #08080d; color: #f2f2f7; font-family: Inter, system-ui, sans-serif;
min-height: 100vh; overflow: hidden;
}
.hint { position: absolute; left: 16px; top: 16px; z-index: 5; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a8a99; }
main { min-height: 100vh; display: grid; place-items: center; padding: 24px; } h1 { font-size: clamp(28px, 5vw, 60px); font-family: ui-monospace, monospace; letter-spacing: -0.04em; }
@media (max-width: 420px) {
.hint { font-size: 10px; letter-spacing: 0.08em; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
</style>
</head>
<body>
<main><h1 id="h">01001000</h1></main>
<script>
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
var target = "Decode the brief";
var h = document.getElementById("h");
function run() {
var step = 0;
var timer = setInterval(function () {
step++;
var out = "";
for (var i = 0; i < target.length; i++) {
if (step > i) out += target[i];
else out += (i + step) % 2 ? "1" : "0";
}
h.textContent = out;
if (step >= target.length) {
clearInterval(timer);
if (!reduce) setTimeout(run, 1200);
}
}, 70);
}
if (reduce) h.textContent = target;
else run();
</script>
</body>
</html>About this effect
The headline starts as 0s and 1s and resolves into “Decode the brief” over 1.2s, 16 steps. It holds, then runs again.
Similar effects
Scramble / Decode Text
Headlines that decode from random characters into the final message, with hover re-trigger.
Split Text Reveal
Characters rotate up from masked lines in a cascading GSAP stagger. No paid plugins.
Typewriter Code
A code editor that types itself, syntax-highlights each line, then deletes and loops.