Into the black hole

My first turtle (not the first one I made public tho), playing with randomized line angles, and patterns in length and position.

Log in to post a comment.

const num_lines = 60; // min = 1 max = 200 step = 1
const r_circle_const = 80; // min = 10 max = 100 step = 1
const r_circle_step = 1; // min = 0.1 max = 5 step = 0.1
Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();
// r_circle = [80,60,40,20];
x_circle = 0;
y_circle = 0;



// The walk function will be called until it returns false.
function walk(i) {
    for(let r_circle = r_circle_const; r_circle > 0; r_circle -= r_circle_step) {
        length = r_circle/6 - i/7;
        angle_line = Math.random()*90;
        angle_circle = r_circle + (i * 360 / num_lines); 
        current_x = x_circle + r_circle * Math.cos(angle_circle * Math.PI / 180);
        current_y = y_circle + r_circle * Math.sin(angle_circle * Math.PI / 180);
        
        turtle.penup();
        turtle.goto(current_x + Math.cos(angle_line * Math.PI / 180)*length/2, current_y + Math.sin(angle_line * Math.PI / 180)*length/2);
        turtle.pendown();
        turtle.goto(current_x - Math.cos(angle_line * Math.PI / 180)*length/2, current_y - Math.sin(angle_line * Math.PI / 180)*length/2);
    }
    
    return i < num_lines;
}