Fractals & Automata
Langton’s Ant
Langton's ant crawls a 121x121 toroidal grid, tracing cyan highways with a glowing recency trail. Auto-resets after ~14000 steps for an eternal loop.
canvasmedium complexitymoderate motion
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
Ambient generative art backgrounds, fractal/automata showcases, creative coding demos requiring low CPU draw.
When not to
Contexts needing immediate visual clarity — the emergent highway pattern takes thousands of steps to form.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change palette to amber: set pal to [[80,50,10],[160,100,20],[230,160,40],[255,220,100]] and update BG/C0 to warm dark tones. 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=121)
- steps per frame (STEPS=90)
- trail fade horizon (MAXAGE=900)
- auto-reset threshold (14000 steps)
- color palette (pal array)
- ant head accent color (232,228,255)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- toroidal wrap logic (ax/ay bounds check)
- Uint8Array/Uint16Array typed grid buffers
- ImageData single-blit paint pattern
- visibilitychange pause/resume
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Grid fixed at 121x121 — increasing N raises per-frame cost
- Auto-reset at 14000 steps interrupts mid-highway patterns
- Background hardcoded in both CSS and BG array — must update both to retheme
More Fractals & Automata components
- Mandelbrot ZoomEscape-time Mandelbrot set zooms slowly into a filigree boundary seam, rendered in smooth red-to-gold color bands on a near-black background.
- Julia MorphJulia set fractal whose complex constant traces a slow Lissajous loop, morphing green filaments between connected and dendritic forms over ~70 seconds.
- Game of LifeConway's Game of Life with glowing magenta cells aging through three color tiers; field reseeds automatically when population collapses.
- LeniaLenia smooth-life automaton: glowing teal-to-cyan blobs drift and pulse on a dark field via a typed-array convolution sim scaled up with CSS.
- L-System FernA fractal fern draws itself branch by branch via an L-system grammar, coloring segments brown-to-gold by depth; it holds then restarts.
- Domain WarpSlowly flowing domain-warped fractal noise rendered in green, sage, and ink tones; layered fbm warp passes produce marbled smoke patterns.