Biomechanical Turtle

H.R. Giger 1940–2014

Log in to post a comment.

Canvas.setpenopacity(0.25);

const turtle = new Turtle();
const sf = 0.01;
const iters = 100000;
let x, y, sx, sy, i, j, si, sj, sine, len, l;

function walk(i) {
    x = -100+200*Math.random();
    y = -100+200*Math.random();
    sx = sf*(100-x)*0.5;
    sy = sf*(100+y)*0.5;
    sine = (Math.cos(2*sx+2*Math.sin(sy))
          + Math.sin(-5*sy+2*Math.cos(sx)))
          * Math.sin(6*Math.acos(sx)*Math.asin(sy))
          * Math.cos(-21*Math.asin(sx)*Math.acos(sy))
    turtle.penup();
    turtle.goto(x,y);
    turtle.seth(sine*360);
    turtle.pendown();
    len = 2+1*sine;
    for (l = len; l > 0.01; l/=2) {
        turtle.forward(l);
        turtle.left(30*sine);
    }
    return i < iters;
}