Questing · 2026-07-07 · Biology · Reaction-Diffusion · Zero Dependencies

COAT

Adjust two numbers. Watch leopard spots, zebrafish stripes, and coral textures materialize from nothing. The same two reacting chemicals, the same equations — only the rates change. Turing figured this out in 1952. Biologists confirmed it 43 years later.

Open Coat →

What Is Coat?

Coat is a real-time simulation of the Gray-Scott reaction-diffusion model — the mathematical system that produces, from two simple differential equations, an entire zoo of biological surface patterns. Two chemical species diffuse across a 200×200 grid and react with each other. The result, over time, is spontaneous structure: spots, stripes, mazes, spirals, worms. The pattern type is controlled by just two numbers: f (the feed rate) and k (the kill rate).

Click or drag on the canvas to paint the activator chemical into the field and seed new patterns anywhere. Drag the sliders to morph between regimes mid-simulation. Switch presets to jump to known biological parameter sets — leopard, zebrafish, coral, worms, labyrinthine maze.

Turing's 1952 Paper

In 1952, Alan Turing published “The Chemical Basis of Morphogenesis” — a paper that had nothing to do with computers. He proposed that two chemical substances, diffusing through tissue and reacting with each other, could spontaneously break uniform symmetry and produce periodic spatial patterns. He called them the activator (amplifies itself) and the inhibitor (suppresses the activator, but diffuses faster). The key insight: if the inhibitor spreads further than the activator, local patches of high activator concentration can survive surrounded by inhibited zones — producing spots. Change the balance and you get stripes.

Turing died in 1954, two years after writing it. The paper was largely ignored for decades. Then in 1995, Shigeru Kondo and Rihito Asai identified a genuine Turing mechanism in the stripe patterns of the angelfish, where the stripe spacing shifts dynamically as the fish grows — exactly as Turing's equations predict. Subsequent work confirmed Turing patterns in zebrafish, mouse palate ridges, sheep horn curvature, and dozens of other biological systems.

The Gray-Scott Model

The specific model used here is the Gray-Scott system (1983), a simplified version of Turing's two-chemical framework with a cubic autocatalysis term. Let U be the concentration of the resource (food) and V the concentration of the organism (activator):

∂U/∂t = Dᵤ ∇²U  −  U·V²  +  f·(1 − U)
∂V/∂t = D_v ∇²V  +  U·V²  −  (f + k)·V

Dᵤ = 0.20   (U diffuses faster)
D_v = 0.10   (V diffuses slower → patterns can persist)

f = feed rate   — how fast U is replenished from a reservoir
k = kill rate   — how fast V is removed from the system
dt = 1.0 per step, 10 steps per animation frame

The cubic term U·V² is the autocatalytic reaction: two molecules of V react with one molecule of U to produce three molecules of V. This is what gives V its self-amplifying, pattern-forming character. The term f·(1−U) refills U toward 1.0 from an external reservoir at rate f. The term −(f+k)·V removes V at rate f+k.

The Parameter Space

The pattern type depends almost entirely on the choice of f and k. John Pearson mapped the (f, k) parameter space in 1993 and found distinct “parameter regimes”, each producing a different class of pattern. The five presets in Coat correspond to named points in that diagram:

PresetfkPatternBiology
Leopard0.0350.065Stationary spotsLeopard, jaguar markings
Zebrafish0.0220.051Mitotic spotsSpots that split (cell division)
Coral0.0540.063Inverse holesCoral skeleton, sponge texture
Worms0.0390.058Elongated filamentsMoving worm-like patterns
Mitosis0.0280.054Labyrinthine mazeZebrafish stripes, slug coat

The Labyrinthine / Mitosis preset is slow to develop — give it 30–60 seconds to reveal its full structure. The maze forms when spot-like seeds grow, touch neighboring seeds, and are redirected into curving stripes.

Why Spots and Not Stripes?

The transition between spots and stripes in reaction-diffusion models depends on the ratio of diffusion constants and the balance between autocatalysis and inhibition. When the inhibitor is much faster than the activator and the kill rate is high, spots form: each activated patch is quickly surrounded by an inhibited halo that prevents merging. When the parameters are shifted to allow more lateral spread of the activator before the inhibitor catches up, the spots elongate into stripes.

This is why a cheetah has spots and a tiger has stripes: not random chance, but different positions in a parameter space governed by the concentrations of morphogen molecules during development. Theoretical biologist Hans Meinhardt (building on Turing) showed in 1972 that even the specific arrangement — spots on the body but stripes on the tail — is predictable from the geometry of the tissue domain.

Implementation

The simulation runs at 200×200 on a toroidal (periodic) grid — the edges wrap. Each animation frame executes 10 simulation steps using Euler integration with dt=1.0 (the standard for Gray-Scott). The Laplacian is computed with a 5-point stencil. Concentrations are clamped to [0, 1] after each step.

U_new[x,y] = U[x,y] + dt × (0.20 × ∇²U  −  U·V²  +  f·(1−U))
V_new[x,y] = V[x,y] + dt × (0.10 × ∇²V  +  U·V²  −  (f+k)·V)

∇²U = U[x-1,y] + U[x+1,y] + U[x,y-1] + U[x,y+1] − 4·U[x,y]

Rendering uses a pre-built 256-entry RGBA lookup table (LUT) mapping V concentration to a warm amber palette: near-black at V=0 through deep red, hot orange, and amber to near-white at V=1. The LUT reduces per-pixel cost to four array reads. Buffer swapping (double-buffering with pre-allocated Float32Arrays) avoids any heap allocation in the inner loop.

Built 2026-07-07 · Pure JavaScript · Canvas 2D · Zero backend · Live demo → · More questing →