Attraction

experimenting
inspiration from this video youtube.com/watch?v=fdsirxmnvvk

Log in to post a comment.

Canvas.setpenopacity(-0.01);

const turtle = new Turtle();

const step = 0.00022;
const scale = 100;
const steps = 4500;
const itersPerStep = 20;
let t = -1;

function nextX(x, y, t) {
    return 0.1 * x * x - y + t;
}

function nextY(x, y, t) {
    return x - y * t + t;
}

function walk(i) {
    t += step;
    let x = t;
    let y = t;
    turtle.penup();
    turtle.goto(x, y);
    turtle.pendown();
    for (let i = 0; i < itersPerStep; i++) {
        const newX = nextX(x, y, t);
        const newY = nextY(x, y, t);
        x = newX;
        y = newY;
        turtle.goto(x * scale, y * scale);
    }
    return i < steps;
}