Diamante Tecida

.

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.5);

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.radians()
turtle.penup()
const radius1 = 80.0
const radius2 = 15.0
const steps = 8192 + 13
const bias = 8.5
const divvie = 15
const xp = Math.floor(steps / divvie) - 0.6
const yp = Math.floor(steps / divvie) + 1.4

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
}