Discord

1950s wallpaper design perhaps

Log in to post a comment.

// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(-50,-20);
turtle.pendown();

function square(len, n, d, as) {
    var da=(Math.random()-0.5)*as
    var db=(Math.random()-0.5)*as
    var dc=(Math.random()-0.5)*as
    var dd = -(da+db+dc)
    for(let i = 0; i<n ; i++) {
        turtle.forward(len-2*i*d)
        turtle.left(90+i*da)
        turtle.forward(len-2*i*d)
        turtle.left(90+i*db)
        turtle.forward(len-2*i*d)
        turtle.left(90+i*dc)
        turtle.forward(len-2*i*d)
        turtle.left(90+i*dd)
        turtle.up()
        turtle.forward(d)
        turtle.left(90)
        turtle.forward(d)
        turtle.right(90)
        turtle.down()
    }
    
}
// The walk function will be called until it returns false.
function walk(i) {
    turtle.penup()
    turtle.goto(40*(i%5)-100,40*Math.floor(i/5)-100)
    square(40,24,1.5,0.35)
    return (i<30)
}