Reaction-Diffusion Simulator
Run the Gray-Scott reaction-diffusion equation in your browser. Two chemicals react and diffuse on a periodic grid to grow corals, spots, stripes, mazes, and dividing cells from a single seed.
Presets
Palette
Click or drag on the canvas to inject chemicals.
The Gray-Scott model
Two chemicals — U and V — share a grid and obey a simple rule: U is constantly fed in, V is constantly removed, and where they meet, V eats U in an autocatalytic reaction. The result is wildly varied life-like patterns from one toy equation.
∂U/∂t = Du∇²U − U·V² + F·(1 − U)
∂V/∂t = Dv∇²V + U·V² − (F + k)·V
F is the feed rate for U, k is the kill rate for V. The Laplacian terms ∇² diffuse each chemical across neighbors. The whole zoo of patterns emerges from the (F, k) plane — small changes here flip the system from stripes to mazes to dividing spots.
Where each preset lives
| Preset | F | k | Looks like |
|---|---|---|---|
| Coral | 0.0545 | 0.0620 | Branching reef |
| Spots | 0.0367 | 0.0649 | Leopard print |
| Maze | 0.0290 | 0.0570 | Labyrinth walls |
| Stripes | 0.0220 | 0.0510 | Zebra bands |
| Mitosis | 0.0282 | 0.0541 | Dividing cells |
| Worms | 0.0580 | 0.0650 | Wriggling filaments |
| Bubbles | 0.0980 | 0.0570 | Soap-like cells |
Why it matters — Turing patterns
In 1952 Alan Turing showed mathematically that two diffusing chemicals with very different rates can spontaneously form stable patterns. He proposed it as a mechanism for how a uniform embryo could grow stripes, spots, or limbs. The Gray-Scott model is the most studied modern descendant of that idea, and the same equations describe coral growth, fish skin, and corrosion fronts.
The simulator runs on a periodic torus — what leaves the right edge re-enters on the left — so patterns are seamless and never run out of room to grow.
Things to try
- Poke the canvas mid-run — click and drag to inject fresh V. Stable patterns will swallow it; unstable ones explode.
- Sweep F up in tiny steps from a Spots preset and watch the dots stretch into worms.
- Slow it down to 1×/frame to see individual reaction events; crank to 14× to fast-forward minutes of growth.
- Switch palette after a pattern settles — same chemistry, different aesthetic, useful for understanding what V level the colours represent.