Squares
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);
const stepSize =20; //min=1 max=200 step=1
const offset = 100; //min=0 max=200 step=1
const count = 100; //min=11 max=2000 step=1
const angle =0; //min=0 max=2 step=0.001
let squareSize =0;
// Global code will be evaluated once.
const turtle = new Turtle();
// The walk function will be called until it returns false.
for(let counter =0; counter <= count; counter ++){
squareSize = stepSize * Math.random();
turtle.penup();
turtle.goto(-90 + (offset *Math.random()) , -90 + (offset * Math.random() ));
turtle.pendown();
turtle.forward(squareSize);
turtle.right(90);
turtle.forward(squareSize);
turtle.right(90);
turtle.forward(squareSize);
turtle.right(90);
turtle.forward(squareSize);
turtle.right(90);
turtle.right(angle);
}