Hopalong

Hopalong attractor. Code derived from evilotto's Lorenz XZ

Log in to post a comment.

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

// Global code will be evaluated once.
const turtle = new Turtle();
const n = 20000; //min=10 max=30000 step=10
turtle.penup();


function project() {
    turtle.jump(x,y);
    turtle.circle(0.01);

}

x = 0.0;
y = 0.0;
project();
turtle.pendown();

const a = 8.44 ; //min=0 max=10 step=.01
const b = 6.47; //min=0 max=10 step=.01
const c = 5.05; //min=0 max=10 step=.01


// The walk function will be called until it returns false. 
function walk(i) {
    nx = y-Math.sqrt(Math.abs(b*x-c))*Math.sign(x);
    ny = a-x

    x = nx;
    y = ny;

    project();
    return i < n
}