Spiral 🐚

A simple spiral of constant width with variable steps.

Log in to post a comment.

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

// Global code will be evaluated once.
const turtle = new Turtle(),
      angle = 45,
      ratio = 360 / angle;
      
let steps = 10000;

// The walk function will be called until it returns false.
function walk(i) {
    turtle.forward((i+1)/(steps/ratio));
    turtle.right(((steps/ratio)/(i+1))*angle);
    return i < steps;
}