Generative Geometry
Voronoi Shatter
14 drifting sites partition the canvas into cool-blue Voronoi mosaic cells; moving the pointer nudges the nearest site toward the cursor.
canvasmedium complexitymoderate motionpointer
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
Worth keeping?
Votes steer what gets built next — sign in to cast one, free to read
When to use it
Dark-theme hero backgrounds, generative art showcases, geometric texture layers behind UI.
When not to
Light backgrounds (hardcoded dark navy). Low-end mobile — per-frame cell loop scales with canvas area.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change site count to 20 by setting N=20, shift hue range to warm tones (h:rnd(20,50)), slow drift by changing the 0.004 multiplier to 0.002. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.
Safe to edit
- site count (N=14)
- hue range per site (rnd(180,210))
- drift speed multiplier (0.004)
- cell resolution divisor (s/64)
- lightness formula (li base 30 + sine offset)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- IIFE wrapper
- prefers-reduced-motion guard (static single frame fallback)
- visibilitychange pause
- DPR-aware canvas sizing
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Background color hardcoded in both CSS and canvas fillRect — must change both to retheme
- Pointer nudge captures md/mdy variables but never uses them (dead code)
- Cell loop is O(N*cells) — large N or small cell size tanks perf on large screens
More Generative Geometry components
- Auto-MazeDepth-first maze carves itself wall by wall on a dark grid with shifting hue; a bright dot marks the active cell. Resets with a new color on completion.
- Truchet Tiles8x8 grid of rainbow quarter-arc Truchet tiles that flip orientation in slow sine waves, weaving shifting interlocked curves across a dark background.
- SpirographA hypotrochoid spirograph traced progressively on canvas with a shifting hue; each cycle completes then resets with new random radii and color.
- L-System PlantAn L-system fractal plant grows branch by branch from the canvas bottom, swaying gently; clicking triggers a wobble and regrows a randomized plant.
- Rotating Mandala12-fold mandala of 5 nested polygon rings that counter-spin, breathe in scale, and cycle through lilac-gold hues. Tap adds a spin impulse.
- Moiré InterferenceThree drifting concentric ring sets in cyan, pink, and green blend additively to create shifting moiré patterns. Pointer steers one ring center.