Generative Geometry
Apollonian Gasket
Recursive Apollonian circle packing with infinite slow zoom; circles shift from gold to blue by depth, with vignette and pointer/click nudge.
canvasheavy 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
Math/science landing pages, generative art backdrops, contemplative infinite-zoom fractal backgrounds.
When not to
Contexts needing legible overlaid text — the constant zoom and vignette compete with reading. Low-end devices may stutter.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the color palette from gold-to-blue to magenta-to-cyan by editing the cr/cg/cb formula: set cr=Math.round(220-heat*80), cg=Math.round(60+heat*140), cb=Math.round(180+heat*60). 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
- zoom speed (t*0.0009)
- max recursion depth (MAX=7)
- color gradient per depth (cr/cg/cb formula)
- curvature cutoff (c4.b>900)
- nudge strength on click (nudge=1.6)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- IIFE wrapper
- DPR-aware canvas sizing
- visibilitychange pause/start
- prefers-reduced-motion static-frame guard
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Hundreds of arc calls per frame — heavier on low-end devices at high DPR
- Background color hardcoded in both CSS and canvas fillStyle — must change both to retheme
- Depth-fade bands shift if MAX recursion depth is changed without recalibrating visD
More Generative Geometry components
- Voronoi Shatter14 drifting sites partition the canvas into cool-blue Voronoi mosaic cells; moving the pointer nudges the nearest site toward the cursor.
- 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.