Circles, circles, circles.
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax Canvas.setpenopacity(1); const iterations = 6; //min = 0, max = 8, step = 1 const size = 90; //min = 10, max = 100, step = 1 const fill = 1 //min = 0, max = 1, step = 1, (empty, filled) // Global code will be evaluated once. const turtle = new Turtle(); function divide(x, y, s, l){ if(l == 0){ const rand = Math.random(); let radius = s * rand; turtle.jump(x, y-radius); turtle.circle(radius); if(fill){ while(radius > 0.05){ radius -= 0.1 turtle.jump(x, y-radius); turtle.circle(radius); } } } else { l--; s /= 2; divide(x+s, y+s, s, l); divide(x+s, y-s, s, l); divide(x-s, y+s, s, l); divide(x-s, y-s, s, l); } } divide(0, 0, size, iterations) // The walk function will be called until it returns false. function walk(i) { return false; }