flock


    var flockers = [],
        flocker;

    while (flockers.length < 40) {
        flocker = new Boid();
        flocker.position.x = canvas.width * Math.random();
        flocker.position.y = canvas.height * Math.random();
        flocker.velocity.x = 20 * Math.random() - 10;
        flocker.velocity.y = 20 * Math.random() - 10;
        flockers.push(flocker);
    }

    function update() {
        window.requestAnimationFrame(update);

        for (var i = 0; i < flockers.length; i++) {
            flockers[i].flock(flockers).update();
        }
    }
    update();