By · Updated

Reaction Diffusion

Growing Coral, Spot and Fingerprint Patterns, With Presets, Speed, Click-to-Seed and Fullscreen

No ratings yet

Press Play to start

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Reaction-Diffusion works

This reaction diffusion simulation grows spots and stripes. Press Play and a few seeds of one chemical spread into a bath of another, growing coral branches, splitting cells or wandering worms depending on the pattern you pick. Click anywhere on the canvas to drop a new seed. It is slow to start and then fills the screen; fullscreen and a high speed setting give the best view.

Reaction diffusion: how it works

Reaction-diffusion is how Alan Turing proposed, in 1952, that a chemically uniform embryo could develop stripes and spots. Two substances spread through a medium at different rates and react with each other, and the interplay between spreading and reacting produces patterns with a characteristic size. It was a mathematical prediction about biology; the same equations have since been found at work in animal coat markings, fish skin, sand ripples and the branching of coral.

The Gray-Scott model. This tool runs the Gray-Scott variant, which is the one most simulations use because it produces the widest range of patterns from two numbers. Chemical A is fed into the system everywhere at a rate f. Chemical B converts A into more B when two B molecules meet one A, and B is removed at a rate k. A diffuses twice as fast as B. That is the whole model, and changing f and k by a few thousandths moves it between completely different regimes.

The patterns. Coral grows branching fronts that fill the space with a maze. Mitosis makes spots that swell and split in two, over and over, like dividing cells. Fingerprint gives parallel ridges with whorls and forks. Worms produces short, moving segments that crawl and merge. Spots settles into a stable field of dots. Each is a preset pair of feed and kill rates; choosing a new one restarts the bath with fresh seeds.

Seeding. The simulation starts with a handful of small squares of B at random positions in a bath of A. Click on the canvas at any time to add another square. Where the pattern has died out this restarts it, and where it is growing it adds a defect that changes the local structure. The edges are fixed rather than wrapped, so patterns meet the border and stop.

Speed and resolution. The bath is computed at one third of the canvas resolution and scaled up, because the diffusion step touches every cell many times per frame and a full resolution grid would be too slow in JavaScript. The speed slider is the number of chemistry steps per frame. Patterns take a few thousand steps to develop, so at the default speed the first minute is mostly growth and the interesting structure arrives after that.

FAQ

Why is nothing happening?

Reaction-diffusion is slow at the start: the seeds have to grow before there is anything to see. Raise the speed slider to 20 and wait twenty seconds. If the seeds have died — which happens for some patterns when they start too close to an edge — click on the canvas to add more.

Can I set my own feed and kill rates?

This version offers named presets so that every setting produces a recognisable pattern. The range of f and k that gives anything but a blank screen or a solid one is narrow, and most of the space is uninteresting, so presets are more useful than two raw sliders.

Why does the pattern stop at the edge?

The border cells are held fixed, which is the simplest boundary condition and avoids wrap seams in the picture. Patterns grow up to the edge and stop there; in fullscreen the edge is the edge of the display.

Is this how animal markings actually form?

It is the leading model, and for some animals — zebrafish stripes in particular — the chemicals involved have been identified. For others the evidence is indirect: the patterns match, and the equations predict correctly how markings change with body size, but the molecular details are still being worked out.

See also: all Simulations & Screensavers tools, Images, Audio, Video & Screen, PDF, SVG, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, Diagram Makers, 3D Science, Tracker Music.

Related tools