Brasília Como É

.

Log in to post a comment.

// You can find the Turtle API reference here: https://turtletoy.net/syntax
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(0.03);

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.radians()
turtle.penup()
const radius1 = 80.0
const radius2 = 30.0
const steps = 8192 + 13
const bias = 7
const xp = Math.floor(steps / 3)
const yp = Math.floor(steps / 3) + 1

function pausecomp(millis)
{
    var date = new Date();
    var curDate = null;
    do { curDate = new Date(); }
    while(curDate-date < millis);
}


function walk(i) {
    var radius = radius1 + (radius2 - radius1) * (i / steps)
    var x = radius * Math.sin((i * xp * 2.0 * Math.PI) / (steps + (i * bias) / steps))
    var y = radius * Math.sin((i * yp * 2.0 * Math.PI) / (steps + (i * bias) / steps))
    turtle.goto(x, y)
    if (0 == i) {
        turtle.pendown()
    }
    else {
        pausecomp(1)
    }
    return i < steps
}