Flocking boids
A canvas-based flocking simulation that animates hundreds of boids following Craig Reynolds’ classic behavioral rules of alignment, cohesion, and separation. Clicking on the canvas adds new boids. The default “By Movement” coloring shades each boid via d3.interpolateWarm based on a moving average of its acceleration magnitude, while an alternative “Rainbow” mode assigns colors via d3.interpolateRainbow. A dat.GUI panel adjusts parameters like flockmate radius, velocities, and starting formations, with each frame rerendering trails on two stacked canvas elements.
AI-generated descriptionPlaying around with Boids-style flocking. Click to add more, coloring by movement colors each boid by a moving average of its acceleration magnitude.
See also: Particle tentacles
More boids:
boids by Hugh Kennedy
boids-canvas by Mike Christensen
boids demo by Anoop Elias
flocking in Processing by Daniel Shiffman
forked from <a href='http://bl.ocks.org/git-ashish/'>git-ashish</a>'s block: <a href='http://bl.ocks.org/git-ashish/172f6d313bae43db22b96be3891ca9b5'>Flocking boids</a>