Live preview · fully interactive
The prompt
Build a pulsing dot grid background. ## Look 4px dots, #c4b5fd, on a 36px grid over #08080d. Resting opacity 0.15. ## Behavior Pulse opacity to 1 at 50% of a 2.4s ease-in-out loop. Delay each dot by (column + row) * 80ms so the wave runs diagonally. ## Design tokens - Dots #c4b5fd; page #08080d. ## Motion - Duration 2.4s. Stagger 80ms per step. ## 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; }
#grid { position: fixed; inset: 0; } .d { position: absolute; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #c4b5fd; opacity: 0.15; animation: pulse 2.4s ease-in-out infinite; } @keyframes pulse { 50% { opacity: 1; } }
@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>
<div id="grid"></div>
<script>
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
var grid = document.getElementById("grid");
var gap = 36;
function build() {
grid.innerHTML = "";
var cols = Math.ceil(window.innerWidth / gap);
var rows = Math.ceil(window.innerHeight / gap);
for (var r = 0; r < rows; r++) {
for (var c = 0; c < cols; c++) {
var d = document.createElement("i");
d.className = "d";
d.style.left = (c * gap + gap / 2) + "px";
d.style.top = (r * gap + gap / 2) + "px";
d.style.animationDelay = ((c + r) * 80) + "ms";
if (reduce) d.style.opacity = "0.8";
grid.appendChild(d);
}
}
}
build();
window.addEventListener("resize", build);
</script>
</body>
</html>About this effect
Dots on a 36px grid pulse opacity from 0.15 to 1 with an animation-delay based on column plus row, so a diagonal wave crosses the stage every 2.4s.