I’ve always been fascinated by the way squid and octopus skin changes color : patches of colour washing across the body, dots opening and closing faster than you can follow. This is my attempt to get that into code.
What’s on screen
Brown chromatophores sit over about a third of the cells and open in travelling waves.
Yellow cells swell and shift from olive to gold in slow-moving groups, which is where the painterly look comes from.
Red dots are scattered between them, pulsing on their own clocks.
The background is a blue-teal gradient with a pale band, covered in thousands of flickering sparkles that stay put while the cells drift over them.
Macro photograph of squid skin by Robert Stansfield
Dark brown chromatophores clostered over smaller yellow cells and tiny red dots, on an iridescent blue background.
How it got here
Ten versions so far. Most of them were wrong in instructive ways.
09
Pointillist pass
Hex packed, closer colors. But it’s still weird looking. Too stiff, the spread like lichen.
01
Pure Reaction-Diffusion
nice pattern, but it looks more like a computer petri dish not a living organism
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
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;