Expanding Circles

Playing around with seth to come up some interesting circles.

Created by dinubs on 2019/4/4
65
1

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();
const radiusRange = [3, 12];
const borderRange = [1, 2];
const iterations = 12;
const fraction = 6;

function random(range) {
  return Math.floor(Math.random() * (range[1] - range[0]) ) + range[0];
}

// The walk function will be called until it returns false.
function walk(i) {
    turtle.home();
    turtle.seth(i / fraction);
    turtle.penup();
    const multiplier = Math.floor(i / 360) + .5;
    turtle.forward(random(radiusRange) * multiplier);
    turtle.pendown()
    turtle.forward(random(borderRange));
    
    return i < 360 * iterations;
}