Live preview · fully interactive
The prompt
Build click ripples on an empty stage. ## Look Rings are 1.5px solid #7c6cff borders, circles, on #08080d. Hint says “Click anywhere”. ## Behavior On pointer down, and every 900ms at a random point in the middle 40% of the stage, grow a ring from 20px to 240px and fade opacity from 1 to 0 over 1100ms, then remove it. ## Design tokens - Ring #7c6cff; page #08080d. ## Motion - Grow duration 1100ms. Auto plant interval 900ms. Linear scale and fade. ## 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; }
.ring { position: fixed; width: 20px; height: 20px; margin: -10px 0 0 -10px; border: 1.5px solid #7c6cff; border-radius: 50%; pointer-events: none; }
@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>
<p class="hint">Click anywhere</p>
<script>
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
function plant(x, y) {
var el = document.createElement("div");
el.className = "ring";
el.style.left = x + "px";
el.style.top = y + "px";
document.body.appendChild(el);
var born = performance.now();
function grow(now) {
var t = Math.min(1, (now - born) / 1100);
var size = 20 + t * 220;
el.style.width = size + "px";
el.style.height = size + "px";
el.style.marginLeft = (-size / 2) + "px";
el.style.marginTop = (-size / 2) + "px";
el.style.opacity = String(1 - t);
if (t < 1 && !reduce) requestAnimationFrame(grow);
else if (t >= 1) el.remove();
}
requestAnimationFrame(grow);
}
window.addEventListener("pointerdown", function (e) { plant(e.clientX, e.clientY); });
if (!reduce) {
setInterval(function () {
plant(window.innerWidth * (0.3 + Math.random() * 0.4), window.innerHeight * (0.3 + Math.random() * 0.4));
}, 900);
}
</script>
</body>
</html>About this effect
Pointer down adds a ring that scales from 0 to 240px and fades over 1.1s. An idle timer plants a ring every 900ms so the card is not empty.