Fork: Lissajous Curve

// From Python Turtle - Lissajous Curve - www.101computing.net/python-turtle-lissajous-curve/

Log in to post a comment.

// Forked from "Lissajous Curve" by rupertxrussell
// https://turtletoy.net/turtle/a39b32449b

// From Python Turtle - Lissajous Curve - www.101computing.net/python-turtle-lissajous-curve/
// 


// 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 scale = 95;  //min=10 max=100 step=1

const A = scale;
const B = scale;
const a = 8.4; //min=1 max=100 step=0.1
const aFine = 0.096; //min=0.001 max=1 step=0.001

const b = 24.8; //min=1 max=100 step=0.1
const bFine = 0.457; //min=0.001 max=1 step=0.001
const delta = 3.14/2;
const stepsCourse = 245; //min=10 max=4800 step=1
const stepsFine = 0; //min=0 max=100 step=1 
const stepsSuperFine = 0.161; //min=0 max=1 step=0.001
var t=0;

turtle.penup();

// The walk function will be called until it returns false.
function walk(i) {
    
    if(i >0){
    turtle.pendown();
    }

    t+=(stepsCourse + stepsFine + stepsSuperFine);

    // Apply Lissajous Parametric Equations
    x = A * Math.sin((a + aFine) * t + delta);
    y = B * Math.sin((b + bFine) * t);

    turtle.goto(x,y)
    return i < stepsCourse + stepsFine + stepsSuperFine;
}