spiral-circles

widening primary circle with lines made up of bubble-spans

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(0,-10);
turtle.pendown();

// The walk function will be called until it returns false.
function walk(i) {
    const numSteps = 550;               // value controls overall size of drawing
    const miniCircleRadius = 5;
    const spiralCircleRadius = i/7 + 5;       
    const extentAngle = 7;                  // in degrees
    
    // draw a small circle at the current pen position
    turtle.circle(i%miniCircleRadius + .1);  // add small CONSTANT for no gaps in string of circles
    
    // move pen along a virtual "spiral" (e.g. a continuous growing cirlce)
    turtle.penup();
    turtle.circle(spiralCircleRadius, extent = extentAngle);
    turtle.pendown();
    
    return i < numSteps;
}