Generative Geometry
Spirograph
A hypotrochoid spirograph traced progressively on canvas with a shifting hue; each cycle completes then resets with new random radii and color.
canvasmedium complexitymoderate motionclick
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-mode hero backgrounds, generative art showcases, math/geometry-themed pages needing ambient motion.
When not to
Light-background layouts (background hardcoded dark navy). Contexts needing static or text-legible overlays.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the hue rotation speed from 30 to 60 in the strokeStyle line, increase lineWidth from 1.8 to 2.5, and set the starting hue to a fixed value like 200 for a consistent blue palette. 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
- hue shift speed (prog*30 multiplier)
- line width (1.8)
- trace span per frame (0.10+boost)
- trail fade (--gg04-fade alpha 0.028: lower = longer trail)
- mount pre-roll (90 frames drawn before first paint)
- radius scale factor (s*0.42)
- inner radius range (0.18+random*0.28)
- pen distance range (0.4+random*0.5)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- GCD-based cycle calculation (ensures clean closure)
- DPR-aware canvas sizing
- visibilitychange pause
- reduced-motion static fallback
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Background color hardcoded in CSS and fillRect — must change both to alter backdrop
- pointerdown boost is subtle; no visual feedback on click
- cyc computed from rounded R/r may produce very long cycles for certain random values
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.
- 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.