Live preview · fully interactive
The prompt
Build a looping kinetic scramble headline. ## Look Centered headline, clamp(28px, 5vw, 56px), tracking -0.04em, color #f2f2f7 on #08080d. Phrases: “Ship the motion.”, “Paste the prompt.”, “Keep the preview.” ## Behavior Every 50ms, characters that have not locked yet show a random glyph from A–Z and 0–9. Lock characters left to right, two ticks apart. Hold the resolved phrase 900ms, then scramble the next one. ## Design tokens - Text #f2f2f7; page #08080d. ## Motion - Tick 50ms. Hold 900ms. Lock delay 2 ticks per character. ## 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, 56px); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
@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="line">Ship the motion.</h1></main>
<script>
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
var phrases = ["Ship the motion.", "Paste the prompt.", "Keep the preview."];
var glyphs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var line = document.getElementById("line");
var phrase = 0;
function play() {
var target = phrases[phrase % phrases.length];
phrase++;
var step = 0;
var timer = setInterval(function () {
var out = "";
for (var i = 0; i < target.length; i++) {
if (target[i] === " ") { out += " "; continue; }
if (step > i * 2) out += target[i];
else out += glyphs[Math.floor(Math.random() * glyphs.length)];
}
line.textContent = out;
step++;
if (step > target.length * 2 + 4) {
clearInterval(timer);
line.textContent = target;
if (!reduce) setTimeout(play, 900);
}
}, 50);
}
if (reduce) line.textContent = phrases[0];
else play();
</script>
</body>
</html>About this effect
Three phrases take turns. Each character cycles through a glyph set for 50ms steps, then locks left to right over about 700ms. It loops.
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.