wormhole

a sad hole

Log in to post a comment.

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

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.radians();
turtle.penup();
const N = 500;
const sep = 20;
const x0 = -25; 
const y0 = -25;

function walk(i) {
    var x , y;
    var r;
    var q = 50 + i;
    r = 20/Math.log10(q/10);
    x = x0+(1+q/sep);
    y = y0+(1+q/sep);
    draw(r,x,y);
    draw(r,2-x,2-y);
    return q<=N;
}

function draw(radius, x_, y_)
{
    var c=0;
    while(c<=1000)
    {
        var xp = radius*Math.sin(c*Math.PI/N) + x_ ;
        var yp = radius*Math.cos((c+100)*Math.PI/N) + y_ ;
        turtle.goto(xp, yp);
        if (c==0) turtle.pendown();
        c = c+1;
    }
    turtle.penup();
}