// From Python Turtle - Lissajous Curve - www.101computing.net/python-turtle-lissajous-curve/
Log in to post a comment.
// 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 = 5.2; //min=1 max=100 step=0.1
const aFine = 0.589; //min=0.001 max=1 step=0.001
const b = 1; //min=1 max=100 step=0.1
const bFine = 0.018; //min=0.001 max=1 step=0.001
const delta = 3.14/2;
const stepsCourse = 2042; //min=10 max=4800 step=1
const stepsFine = 48; //min=0 max=100 step=1
const stepsSuperFine = 0.944; //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;
}