Click to add points
var pathFollower = new Boid();
pathFollower.setBounds(graphics.width, graphics.height);
pathFollower.edgeBehavior = null;
// build circular path
var path = [],
x = canvas.width / 2,
y = canvas.height / 2,
radius = 200,
count = 8,
angle = Math.PI * 2 / count,
point;
for (var i = 0; i < count; i++) {
point = Boid.vec2();
point.x = x + radius * Math.cos(i * angle);
point.y = y + radius * Math.sin(i * angle);
path.push(point);
}
function update() {
window.requestAnimationFrame(update);
pathFollower.followPath(path, true).update();
}
update();