spiral tourus
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();
const tightness = 30, outerRadius = 0.5;
// The walk function will be called until it returns false.
function walk(i) {
const t=i/1000
const x=Math.sin(t)*(1+Math.sin(t*tightness)*outerRadius);
const y=Math.cos(t)*(1+Math.sin(t*tightness)*outerRadius);
const z=Math.cos(t*tightness)*outerRadius;
turtle.goto(x*60+(Math.random()-0.5)*(y+1+outerRadius)*3,(y+z)*60/2);
turtle.pendown();
return i < Math.PI*1000*2;
}