Reaction Diffusion
Organic patterns that grow and settle from a live reaction-diffusion simulation.
Overview
Reaction Diffusion runs a Gray-Scott simulation on the GPU. Two chemicals spread across a grid at different rates, one feeding on the other, and stable shapes emerge on their own: branching coral, separate spots that split, a winding maze, or a drifting pattern that never settles.
The pattern is drawn in one color with soft, antialiased edges on a transparent background, so it works on light and dark pages. With the default currentColor it follows the text color and theme. Use it behind a section heading, on an empty state, or as a quiet texture on a 404 page.
The simulation starts from scattered drops and grows for a moment before the first frame. Moving the pointer across it seeds new growth along the pointer's path.
Installation
Usage
import { ReactionDiffusion } from "honestui/shaders"
<div className="relative h-96 text-foreground">
<ReactionDiffusion className="absolute inset-0" pattern="coral" opacity={0.35} fade="radial" />
<h2 className="relative">Grown, not drawn.</h2>
</div>Each pattern grows from fresh drops, so changing pattern starts the simulation again. A new seed gives a different starting layout of the same pattern.
Patterns
Accessibility
Reaction Diffusion is decorative and its canvas is hidden from assistive technology. Put text and actions in normal HTML. Keep opacity low behind text, or use fade so the pattern stays away from it, and check contrast where the pattern is densest.
When the user prefers reduced motion, or paused is set, the simulation runs ahead to a settled pattern and shows it as a still frame. It also stops while it is offscreen or the tab is hidden. The simulation needs WebGL2 with floating-point render targets; without them, the container shows only its background.
Performance
The simulation runs on a grid coarser than the screen: one cell is scale CSS pixels. A larger scale gives larger shapes and costs less. Changing scale or seed restarts the simulation.