This is a lightweight 2D JavaScript implementation of Craig Reynolds' Boids algorithm. It's a classic example of emergence and a suprisingly simple way of mimicking not only flocks, but any form of swarm or herd or crowd.

Right now you're watching many boids being simulated at 60 frames per second.

Source on GitHub