Turing Patterns
Two chemicals diffusing and reacting on a toroidal grid, governed by the Gray-Scott equations. From a nearly uniform state, the system spontaneously breaks symmetry and freezes into spots, stripes, worms, coral branches, and self-replicating blobs — depending on a single pair of parameters. Alan Turing proposed the mechanism in 1952 to explain animal coat markings. It works.
The equations
The Gray-Scott model tracks two chemicals, U (the feed species) and V
(the self-catalytic activator), across a 2D domain:
∂U/∂t = Du ∇²U − UV² + F(1−U)
∂V/∂t = Dv ∇²V + UV² − (F+k)V
The reaction term UV² converts U into V autocatalytically —
one V molecule combines with two more to make three. F is the feed rate:
fresh U supplied continuously to compensate the reaction. k is the kill
rate: V is removed at a constant rate independent of concentration. Both species
diffuse, but U diffuses roughly twice as fast as V, creating the
short-range activation / long-range inhibition asymmetry that drives pattern formation.
Turing's insight (1952)
Alan Turing's paper The Chemical Basis of Morphogenesis showed that a uniform mixture of two reacting and diffusing chemicals is unstable if one inhibits the other and the inhibitor diffuses faster. Small perturbations amplify into stable spatial patterns — spots, stripes, and labyrinths — whose wavelength is set entirely by the reaction-diffusion kinetics, not by initial conditions. The patterns you see here are numerical solutions to a simplified version of exactly that system. Leopard spots, zebra stripes, fish skin markings, and fingerprint ridges all fall under the same theoretical umbrella.
Parameter space
F and k determine everything about the final morphology. John Pearson's 1993 survey mapped the (F, k) plane into about a dozen distinct pattern classes, labeled by letter. The six presets here sample a subset of that space:
Worms (F=0.078, k=0.061) — the default. Labyrinthine tubes fill the
plane and evolve slowly toward a stationary tangle.
Spots (F=0.035, k=0.065) — isolated blobs, like a leopard's coat.
The background state is stable; spots are the only excited structures.
Coral (F=0.040, k=0.060) — branching filaments that spread outward
from the seed and stabilise into a coral-like network.
Mitosis (F=0.028, k=0.053) — spots grow and split like dividing
cells, slowly filling the plane via replication rather than diffusion.
Stripes (F=0.060, k=0.062) — parallel stripes with a well-defined
wavelength. Analogous to zebra stripes in the Turing framework.
Waves (F=0.014, k=0.054) — oscillatory or travelling waves. This
regime sits near the Hopf bifurcation and can support spiral and target patterns.
Implementation
The simulation runs on a 300 × 225 grid (67,500 cells) with toroidal
(wrap-around) boundary conditions — the domain is a torus. The Laplacian uses a
standard 5-point stencil. Time integration is forward Euler with Δt = 1,
which is unconditionally stable for the chosen diffusion coefficients and step size;
the system is numerically well-conditioned for the parameter ranges on offer.
Each animation frame runs 8 simulation steps before rendering, blitting a scaled
ImageData pixel buffer to the stage canvas. Two Float32Array
buffers are swapped each step — no allocation in the hot path.
Colour maps V × 3 through a perceptually-tuned cyan gradient matching the
site palette: background concentrations (V ≈ 0) render as deep navy;
active structures (V ≈ 0.25–0.35) appear bright cyan.
Controls
Left-click and drag on the stage to paint new V concentration —
draw your own initial conditions and watch patterns grow from them.
Right-click and drag to erase back to the U=1, V=0 quiescent state.
Presets update F and k and restart the simulation.
Adjust F and k manually between presets to explore the transitions —
the boundaries between pattern classes are often the most interesting regions.