Playground · Reaction-Diffusion
Reaction-diffusion
Two chemicals — one feeding, one killing — spread and react across a grid, and out of the noise come spots, stripes and coral. These are Turing patterns: the maths Alan Turing proposed in 1952 for how a leopard gets its spots. Pick a recipe, or paint into it.
Click or drag to paint seeds into the reaction.
How it's built
The Gray-Scott model: chemical U is fed in, V
is removed, and the reaction U + 2V → 3V converts one into the other. Both
also diffuse (spread out) at different rates. Each step applies those two rules to every
cell using a Laplacian (a 3×3 stencil) in vanilla JS on a <canvas>. Tiny changes to the
feed and kill rates flip the whole system between spots, stripes, mazes and endlessly
dividing blobs — pattern formation from pure local chemistry.