Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax Canvas.setpenopacity(1); const times = 2; //min=2 max=50 step=.01 const steps = 50; //min=3 max=360 step=1 const r = 95; // Global code will be evaluated once. const turtle = new Turtle(); const pt = (frac) => [-Math.cos(frac*2*Math.PI), Math.sin(frac*2*Math.PI)]; const scale2 = (p, s) => [p[0]*s,p[1]*s]; Array.from({length: (Math.PI*2*r)}).forEach((v, i, a) => turtle[i==0?'jump':'goto'](scale2(pt(i/(a.length-1)), r))); // The walk function will be called until it returns false. function walk(i) { turtle.jump(scale2(pt(i/steps), r)); turtle.goto(scale2(pt(i*times/steps), r)); return i < steps; }