Your browser doesn't support html5's <canvas> tag. Upgrade to an HTML5-compliant browser, such as Firefox or the beta for Internet Explorer 9!

Boids!
This is a simple implementation of the Boids rules in HTML5. The rules are as follows:

  1. Move to where everyone else is hanging out.
  2. Face the same direction everyone else is.
  3. Move away from anyone who is too close.

These three rules are enough to simulate a flocking behavior.
They'll chase your mouse or finger if you click near them and drag.

All of the source code is within this html file, so feel free to check it out.