Spirally Star

Accidental

Log in to post a comment.

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

console.log(Canvas)

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

const rows = 12;
const cols = 11;
const width = 200;
const height = 200;
const margin = 10;

function star(points, scale) {
    if (typeof(scale) === 'undefined') scale = 1.0;
    turtle.pendown();
    for (var i = 0; i < 1; i++) {
        turtle.forward(20 * scale);
        turtle.right(720 / points);
        turtle.forward(20 * scale);
        turtle.left(720 / points / 2);
    }
    turtle.penup();
}

// The walk function will be called until it returns false.
function walk(i) {
    steps = 100;
    scale = 5 * (steps - i) / steps;
    star(5, scale);
    turtle.left(24/steps)
    return i < steps;
}