Super Nova

"Elegant AND pretty" - Sparrow (in reference to another piece I made)

Log in to post a comment.

const skew = .62; // min = 0 max = 1 step = 0.001
const focus = 1.08; // min = 0 max = 2 step = 0.001
const steps = 75; // min = 1 max = 100 step = 1
const ellipse_steps = 50; // min = 1 max = 50 step = 1
const scale = 80; // min = 10 max = 100 step = 0.1


const turtle = new Turtle();

for(let i = 0; i < steps; i++) {
    ellipse(ellipse_steps, (1-skew)*scale*Math.sin(i), (1+skew)*scale*Math.cos(i), focus*i, 0, 0)
}

function ellipse(steps, a, b, theta, x_center, y_center) {
    t = Math.PI * 2 / steps;
    turtle.penup();
    for(i = 0; i <= steps; i++) {
        if(i == 1) {
            turtle.pendown();
        }
        x = x_center + a*Math.cos(theta)*Math.cos(t*i) - b*Math.sin(theta)*Math.sin(t*i);
        y = y_center + a*Math.sin(theta)*Math.cos(t*i) + b*Math.cos(theta)*Math.sin(t*i);
        turtle.goto(x,y);
    }
}