An simple example
Uses a slider to draw up to 22 sides
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(-30,-90); turtle.pendown(); // The walk function will be called until it returns false. const sides = 3 // min=3, max=22, step=1 function walk(i) { turtle.forward(90 - sides * 4); turtle.right(360 / sides); return i < sides -1; }