Live preview · fully interactive
The prompt
Build film grain over a violet wash. ## Look A radial wash from #2a2148 at 50% 30% to #08080d at 62%. A canvas covers the page at opacity 0.28 and is drawn at 160×100 so the pixels scale up. ## Behavior Every 80ms, fill the canvas with random grayscale pixels. ## Design tokens - Wash #2a2148 to #08080d; grain is white-to-black noise. ## Motion - Repaint interval 80ms. ## Constraints - Single self-contained HTML file. No libraries. Canvas 2D. - 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; }
.wash { position: fixed; inset: 0; background: radial-gradient(circle at 50% 30%, #2a2148, #08080d 62%); } canvas { position: fixed; inset: 0; width: 100%; height: 100%; opacity: 0.28; 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>
<div class="wash"></div><canvas id="c"></canvas>
<script>
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
var canvas = document.getElementById("c");
var ctx = canvas.getContext("2d");
function resize() { canvas.width = 160; canvas.height = 100; }
resize();
function paint() {
var img = ctx.createImageData(canvas.width, canvas.height);
for (var i = 0; i < img.data.length; i += 4) {
var v = Math.random() * 255;
img.data[i] = img.data[i + 1] = img.data[i + 2] = v;
img.data[i + 3] = 255;
}
ctx.putImageData(img, 0, 0);
}
paint();
if (!reduce) setInterval(paint, 80);
</script>
</body>
</html>About this effect
A canvas redraws random gray pixels into a tile every 80ms at low alpha, over a static radial wash. The grain is the motion.