Backgrounds

Turing

Gray-Scott reaction-diffusion on the GPU. Two reagents, four terms, and coral, labyrinths and colonies that settle and stop all fall out of the arithmetic — a background that grows rather than loops, and never reaches the same frame twice.

Install

bun add ogl

Then copy 2 files into your project:

  • components/registry/turing/turing.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
feednumber0.05Rate at which fresh reagent arrives everywhere. Feed and kill together pick the creature, and these coordinates were measured rather than inherited: 0.050/0.062 keeps colonising and is the default, 0.030/0.062 settles into stable spots and then genuinely stops, 0.039/0.058 floods to a dense labyrinth, and 0.022/0.051 oscillates without ever settling. Push feed past about 0.055 at this kill and the colonies die outright — the living band is a few thousandths wide, which is why the step is this fine.
killnumber0.062Rate at which the reacted product is removed. Pull it down and the pattern floods until it fills the plate; push it up and it starves back to nothing. The edge of the living band is a cliff rather than a slope, so this control does nothing and then does everything.
diffusionnumber1How fast the substrate spreads relative to the activator, which is held at half. One is the canonical two-to-one. Turing's result is that a perfectly uniform system develops structure the moment one reagent outruns the other; this is that ratio, and below about 0.6 there is nothing to see because nothing outruns anything.
stepsnumber16Solver iterations per displayed frame, and the only reason this is watchable. The pattern needs a couple of thousand steps before it is worth looking at; at one step per frame that is most of a minute of staring at dots. Sixteen gets there in seconds and looks identical on arrival, because this is a time-scale control rather than a quality one. It is also the honest performance dial — every step is a full pass over the grid.
gridSize"256" | "384" | "512" | "768""512"Resolution of the simulation grid, deliberately held apart from the canvas — a window drag resizes only the display pass, so dragging the browser never wipes a pattern that took thirty seconds to grow. Bigger is finer filigree over the same area, not more area.
seed"spots" | "ring" | "stripe" | "noise""spots"How the plate is inoculated. Each one ends up somewhere different at identical feed and kill, which is the honest demonstration that this system has no single attractor — the initial condition is a real parameter, not a formality.
brushnumber26Radius the pointer inoculates. Measured against the grid rather than the canvas, so the blob covers the same share of the pattern on a narrow strip as on a full page. The dose is one impulse per frame regardless of how many solver steps run, so this control and the step count stay independent.
sharpnessnumber0.5Where the palette ramp cuts the continuous field. The chemistry is smooth everywhere; coral does not look like coral until you cut it, and this is the cut. At zero you are looking at the raw concentration, which is the most informative view and the least striking one.
colorLowstring (hex)"#0a0a12"The plate, where nothing has taken hold.
colorHighstring (hex)"#a855f7"The colony. The membrane picks it up too, at a third strength, so the boundary reads as the same organism rather than as an outline drawn around it.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Hover effect
Visual change when the cursor moves over an element.
Compositing
Letting the GPU move or fade an element on its own layer without redoing layout or paint.
Frame rate (FPS)
Frames drawn per second. 60fps is the baseline for smooth motion; 120fps on newer displays.

Related Components

Appears In