Bullet time

Smith is the one.

Log in to post a comment.

Canvas.setpenopacity(0.125);

let turtles = [];
let j, nt;

const spawnTurtle = (x = -100, y = 0) => {
    const turtle = new Turtle();
    turtle.penup();
    turtle.goto(x, y);
    turtle.seth(180);
    turtle.mod = -0.1+0.2*Math.random();
    turtle.energy = 1+1*Math.random();
    turtle.step = 1;
    turtle.root = true;
    turtles.push(turtle);
}

function walk(i) {
    if (i%300==0) {
        spawnTurtle(100, -80+160*Math.random());
    }
    turtles.map(turtle => {
        if (turtle.root) {
            turtle.penup();
            turtle.forward(turtle.energy/7+turtle.step*0.03);
            turtle.right(turtle.mod);
            turtle.mod *= Math.sin(0.01*i);
           
            for (j = 0; j < 2; j++) {
                nt = turtle.clone();
                nt.energy = turtle.energy/2;
                nt.step = 0.125;
                j%2==0 ? nt.left(90) : nt.right(90);
                turtles.push(nt);
            }
        } else {
            turtle.pendown();
            turtle.forward(turtle.energy/100+turtle.step);
            turtle.step *= 0.95;
        }
        
        turtle.energy *= 0.9985;
    });
    turtles = turtles.filter(turtle => turtle.energy > 0.2 && turtle.step > 0.01 && turtle.x() >= -100);
    return i < 4000 && turtles.length > 0;
}