Visualizations
292 / 500

292 · Emergence

Lenia

Smooth artificial life: glowing creatures that glide, spin and divide.

Lenia is Conway's Game of Life made continuous. Every cell holds a value between 0 and 1, sums up its neighbors through a smooth ring-shaped kernel, and grows or shrinks according to a bell-shaped growth function. With the right parameters, stable creatures emerge: Orbium glides, the spinner rotates in place, and the colony grows by dividing. The kernel is up to 37 cells wide, so the convolution is done with a hand-written FFT on a grid stored in typed arrays.

Try it. Click to drop a new creature. Drag to paint life. Press 1 to 3 to switch species (Orbium, Spinner, Colony) and R to reseed.

  • Continuous cellular automata
  • FFT convolution
  • Typed arrays

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a Lenia simulation (Bert Chan's continuous Game of Life) with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a canvas that fills the window. Simulate a 128 by 128 grid that wraps around at the edges, store it in a Float32Array of values between 0 and 1, and draw it scaled up with image smoothing on.
- Build the kernel: for every offset within radius R = 13, compute r = distance / R and weight it with the smooth bump exp(4 - 1 / (r * (1 - r))), which is zero at the center and the edge, so the kernel is a soft ring. Normalize the weights to sum to 1.
- Each step, compute U, the kernel-weighted sum around every cell. Then apply the growth function G(U) = 2 * exp(-((U - m)^2) / (2 * s^2)) - 1 with m = 0.15 and s = 0.015, and update A = clamp(A + G(U) / 10, 0, 1).
- Seed the world with a few discs of random values. Most will die, but some should settle into a gliding creature called Orbium.
- Do the convolution directly first, skipping the many zero weights. Keep the grid small.

Once that works, make it beautiful:
- Map values through a glowing palette (deep violet, magenta, amber, white) and keep a fading trail buffer so moving creatures leave comet tails.
- Add a cheap bloom: draw the frame into a small canvas and stretch it back over the top with "lighter" blending.
- Let me click to drop a new random seed and drag to paint life.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as computing the convolution with an FFT so the grid can be much larger, trying multi-ring kernels for other species, or an autopilot that keeps the world populated.
PreviousRendezvousDock a capsule with a station, where thrusting toward it sends you backward. NextEuclidean RhythmsRisograph bead rings play world rhythms made by a neutron accelerator timing algorithm.

Related visualizations

  • Turing PatternsEmergence Two chemicals react and diffuse into coral, spots and stripes.
  • Falling SandSimulation Sand, water, fire, lava and plants that all react with each other.
  • Particle LifeEmergence Colored particles with simple attractions that assemble into living cells.
  • Automaton OrchestraEmergence Elementary cellular automata woven into cloth on a loom and played as music.
  • Self-Replicating LoopsEmergence Langton's 1984 loops copy their own genome and tile the plane with a glass colony.
  • Growing Neural CellsMachine learning Cells running one tiny learned rule grow a gecko from a single seed and heal its wounds.
  • Rock Paper LizardsEmergence Three lizard morphs chase each other in spirals until mobility tips them into extinction.
  • Cell SortingEmergence A Cellular Potts tissue unmixes itself by differential adhesion, on a stained slide.
  • CooperationEmergence A few defectors in a sea of cooperators unfold into an endless symmetric kaleidoscope.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs