Centered Arc 001

Draws arcs

Log in to post a comment.

// Forked from "test002" by rupertxrussell
// https://turtletoy.net/turtle/babc0b41f0

// You can find the Turtle API reference here:   
//  https://turtletoy.net/syntax

const xPos =-15; // min=-100 max=100 step=1
const yPos =0; // min=-100 max=100 step=1
const rotate= 360; // min=-1 max=360 step=0.1
const startAngle=-124; // min=-360 max=360 step=1
const endAngle=-360; // min=-360 max=360 step=1
const count=90; // min=10 max=120 step=1
const radius=80; // min=10 max=120 step=1
const n=1; // min=-2 max=5 step=0.1
Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();

for(var i=0; i < count; i++){
centeredArc(xPos, yPos, radius -i * n, startAngle, endAngle);
}

function centeredArc(x,y, radius, startAngle, endAngle) {
  turtle.jump(x,y-radius);
  turtle.penup();
  turtle.circle(radius, startAngle + rotate);  // move to start
  
  turtle.pendown();
  turtle.circle(radius, endAngle - startAngle);  // draw to end
}