Live preview · fully interactive
The prompt
Build a spotlight sweeping a headline. ## Look Headline clamp(36px, 7vw, 80px), tracking -0.05em, base color #8a8a99. A radial-gradient 80px circle of #fff clipped to the text. Page #08080d. ## Behavior Move the gradient center --x from -10% to 110% over each loop. ## Design tokens - Base #8a8a99; spotlight #fff; page #08080d. ## Motion - Loop 2800ms, linear. ## 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; text-align: center; } h1 { font-size: clamp(36px, 7vw, 80px); letter-spacing: -0.05em; line-height: 0.95; color: #8a8a99; background: radial-gradient(80px circle at var(--x), #fff, transparent 70%); -webkit-background-clip: text; background-clip: text; }
@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">Light finds the line.</h1></main>
<script>
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
var h = document.getElementById("h");
function frame(now) {
var p = reduce ? 0.5 : (now % 2800) / 2800;
h.style.setProperty("--x", (p * 120 - 10) + "%");
if (!reduce) requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script>
</body>
</html>About this effect
A radial white highlight travels from left to right through clipped text over 2.8s, then repeats. The base text stays a dim #8a8a99 so the sweep reads.
Similar effects
Interactive Particle Hero
A canvas particle field that reacts to the cursor, with a staggered GSAP headline entrance.
Gradient Mesh Hero
Slow-drifting blurred color blobs with a film-grain overlay behind a fade-in headline.
Glitch Hero
RGB-split glitch headline with tearing clip-path slices over a scanline backdrop.