This library provides a api that allow you to control animal motion such as bird flock and fish school.
Here is a very basic example.
<script src="http://after12am.github.com/boids.js/boids.js"></script>
<script>
window.onload = function() {
var v = new boids.SteeredVehicle( -200, 0, 0 );
var target = new boids.Vector3( 200, 0, 0 );
function animate() {
setTimeout(animate, 1000 / 30);
update();
}
function update() {
v.seek(target);
v.update();
console.log(v.position.x, v.position.y, v.position.z);
}
animate();
}
</script>