Home

The Ghost in the Swarm

Colored particles push and pull on their neighbors. I added a flow field that steers the swarm through spirals and rings.

·
Starting simulation…
drag to push · swipe to fling
Controls
Force matrix

Tap a cell to change it. Green attracts; red repels.

Flow field

An extra force that steers the particles through changing patterns.

3.5
Physics
30k
32
1.00
0.55
0.30
4.0
8
Saved setups

Save colors and settings for later, in this browser.

In Particle Life, each particle reacts to nearby colors. The force matrix sets which colors attract or repel; a short-range repulsion also pushes them apart. Different settings produce clusters, chains, or scattered particles.

Starlings flying in a broad flock above a field near Gretna.
A starling murmuration near Gretna. Photo by Walter Baxter, CC BY-SA 2.0.
Flow field

Steering the particles

The "ghost" is an extra force I added to the simulation. Its direction depends on position in the frame. It nudges passing particles along paths that form spirals and rings.

Turn the field off to see the color-based interactions alone. Choose a pattern from the menu to hold it, or check Cycle automatically to let the shapes blend into one another. Density layers applies a second pattern to tightly packed particles.

Drag a finger or mouse through the swarm to push particles aside. A quick swipe sends them flying. Hold Shift while dragging with a mouse to stir them instead.

Unlock raises the desktop limit from 40,000 to 100,000. On phones, it raises the limit from 8,000 to 40,000.

This builds on Ventrella's Clusters, Tom Mohr's Particle Life, and lisyarus's WebGPU implementation. The simulation and added flow field are in particle-life.js.