A reaction-diffusion simulation
I’ve always been fascinated by the way cephalopod skin moves — the rippling waves of colour, the dots appearing and disappearing. I wanted to try and recreate that in code.
I had the idea and the reference images. Claude did the heavy lifting — writing the simulation code, debugging it, and iterating toward something that actually looks like squid skin.
Under the hood it runs two systems at once: a reaction-diffusion algorithm that generates the organic background texture, and an excitable medium that propagates waves across the surface the way nerve signals actually travel through a squid’s mantle.
You can click or drag on the skin to trigger your own waves, and switch between behavioural states — resting, rippling, alarm — using the buttons below the canvas.
This is a living experiment — I’ll keep pushing it further.
Click or drag to trigger expansion waves
This simulation models the living skin of a cephalopod — squid, octopus, cuttlefish — using two layered computational systems running simultaneously in the browser.
The background texture is driven by a Gray-Scott reaction-diffusion system — a pair of virtual chemicals (an activator and an inhibitor) that diffuse and react across a grid, spontaneously forming the organic spotted and labyrinthine patterns seen in animal pigmentation. The same mathematics underlies the spots on a leopard, the stripes on a zebrafish, and the patterns on real cephalopod skin.
On top of this, an excitable medium — modelled after the behaviour of biological nerve tissue — propagates travelling waves across the skin. Each point on the grid can fire, then enter a refractory period before it can fire again. This naturally produces circular wavefronts that annihilate on collision, closely matching how chromatophore expansion signals actually spread across a squid’s mantle.
Three cell types are rendered: large dark chromatophores (pigment-filled sacs that expand under muscular control), smaller yellow-green xanthophores, and tiny scattered erythrophores that provide the magenta-red punctuation visible in close-up photography of real squid skin. All cells are invisible at rest and only appear as an excitation wave passes through them.
Technique
Gray-Scott RD + excitable medium, Canvas 2D, pure JS
Reference
Close-up photography of Loligo vulgaris (European squid) skin
Interaction
Click or drag to inject a wavefront;
sliders control speed, density, and expansion
Made with
Claude Sonnet 4.6 — iterative creative coding session
Thinking about how to imitate the cool patterns in octopus skin.
Test from several years ago!
Octopus-skin
Oscillators drift, synchronize, and modulate color by phase
Tech Stack: p5.js
// ⏳ 1. STEPPING THE TIMELINE FORWARD
// Every frame, each point steadily builds up its internal timer
p.phase += p.freq;
// ⚡ 2. THE FLASH & TRIGGER EVENT
// When a point reaches full charge, it resets and signals a flash
if (p.phase >= 1) {
p.phase = 0;
p.flash = 1; // Instantly jump to max brightness
// 🌐 3. SPREADING THE SIGNAL TO NEIGHBORS
// Check all other points; if they are close enough, nudge them closer to flashing
for (let q of points) {
if (p === q) continue;
let d = dist(p.x, p.y, q.x, q.y);
if (d < couplingRadius) {
q.phase += couplingStrength; // Give the neighbor a phase boost
if (q.phase >= 1) q.phase = 0;
}
}
}
// 📉 4. THE GLOW FADE EFFECT
// Smoothly decay the brightness over time so it behaves like a pulse
p.flash *= 0.90;

