This example is an implementation of a simple flocking algorithm that uses the dynamics of repulsion, attraction, and orientation zones. This example is based off of the algorithm described by Couzin.
The basic principle is that each agent has three regions in a growing radius around it: a zone of repulsion, a zone of orientation, and a zone of attraction respectively. By editing the sizes of these zones you can expect to experience different behaviour.
Play
button to start animationPause
button to stop animationNext
button to do one time step of the algorithm.Dragging/Zooming behavior forked from mbostock's block: Drag & Zoom II
forked from lwthatcher's block: Directional Forces
forked from lwthatcher's block: Flocking
https://d3js.org/d3.v4.min.js