forever components

Generative Geometry

Truchet Tiles

8x8 grid of rainbow quarter-arc Truchet tiles that flip orientation in slow sine waves, weaving shifting interlocked curves across a dark background.

canvasmedium complexitymoderate motionclick

Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited

Live demo — the real component, running in a sandbox. One self-contained HTML file, zero dependencies. Open it on the canvas →
Worth keeping? Votes steer what gets built next — sign in to cast one, free to read

When to use it

Generative art backgrounds, creative portfolio heroes, or anywhere a hypnotic geometric pattern is needed without heavy compute.

When not to

Contexts needing legible text overlaid — rainbow hues and constant flipping compete with copy. Not suited to light backgrounds without restyling.

Working with an AI agent

Every component ships agent-ready metadata. An example instruction for this one:

Change the grid size to 12x12 by setting n=12 in build(), shift the color to cool blues by changing the hue formula to (t*0.02+x*12+y*12+200)%360, and thicken the stroke to cell*0.22. 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

  • grid size (n=8 in build())
  • hue animation formula (t*0.02+x*16+y*16)
  • stroke width (cell*0.16)
  • flip speed per cell (c.sp range 0.4..1.2)
  • background color (#1a1224)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • DPR-aware canvas sizing
  • visibilitychange pause guard
  • prefers-reduced-motion static draw fallback
  • IIFE wrapper
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Background color hardcoded in both CSS and JS fillStyle — must change both
  • Grid is always square; non-square layouts require refactoring ox/oy math
  • Click flips only base orientation (r), not the live flip — effect is subtle during wave motion

truchetgenerativecanvasgridarcsrainbowloop

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.
  • 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.