← Back to the desk

2026 Flocking simulationCanvas 2DMediaPipe

Chase them with your cursor, click to startle them

Murmuration

Thousands of starlings over a Flemish horizon at dusk. Your pointer is a falcon they swerve around, and a click sends a ripple of alarm through the flock.

On autumn evenings, starlings gather in clouds of thousands that fold and pour across the sky. Murmuration puts one over a flat Flemish horizon of poplars, a church tower and turning wind turbines. Hunt it with your pointer, startle it with a click, or step in front of the camera and watch the birds flow around you.

How it works

Every bird is simulated in 3D and seen through a simple perspective camera. Each one follows at most seven neighbours, which is what real starlings do, and that limit is what gives the flock its rolling, elastic shape. A spatial hash keeps the neighbour search fast enough for up to 2,400 birds in a plain 2D canvas. Alarm passes from bird to bird, so a scare travels through the flock as a dark wave, just as it does over a reed bed.

Now and then the flock settles into the project's name before scattering again. Four skies change the light from afternoon to night. The soundscape is synthesised: evening wind, the rush of wings swelling with the alarm, and starling chatter that grows busier when the flock is nervous. Camera mode cuts you out of your webcam image on the device and turns you into a figure the birds avoid.

Built with

  • A 3D boids simulation (seven-neighbour rule, spreading alarm, spatial hashing)
  • Canvas 2D rendering in perspective, with birds fading and thinning into the distance
  • Web Audio API for wind, wings and calls
  • MediaPipe selfie segmentation, running on the device