Polygon

An simple example
Uses a slider to draw up to 22 sides

Log in to post a comment.

// Global code will be evaluated once.
const turtle = new Turtle(-25, -40);
const n = 6; //min=3 max=10 step=1

// The walk function will be called until it returns false.
function walk(i) {
    turtle.forward(150 /n * 2);
    turtle.right(360 / n);
    return i < n;
}