Heart of 2021

Generate some SVGs for my wall hanging plotter. 5000 lines could be real CRASH TEST. :-)

Log in to post a comment.

// Forked from "Heart of M87" by Jurgen
// https://turtletoy.net/turtle/e6727b8fd6

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

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.radians();

    let Angle = 2; // min=-2, max=2, step=0.25


// The walk function will be called until it returns false.

function walk(i) {
    
    let Lines = 5000; // min=100, max=5000, step=100
    
    let r = ((.1 / (1 - Math.random())) * Math.SQRT2 * 80) + 20;
    let t = Math.random() * 2 * Math.PI;
     
    turtle.penup();
    turtle.jump(Math.cos(t) * r, Math.sin(t) * r);
    turtle.seth(t + (Math.PI / Angle));
    turtle.forward(10);
    turtle.left(Math.PI);
    turtle.pendown();
    turtle.forward(20);
return i < Lines;
}