Australian ABC logo
abc.net.au/science/holo/liss.htm
Lissajous Curve
Log in to post a comment.
// Lissajous Curve in TurtleToy JavaScript // Based on code from https://www.101computing.net/python-turtle-lissajous-curve/ // https://turtletoy.net/turtle/42723f4f67 const scale = 66; //min=5 max=100 step=1 const B = 10; const a = 1; // min=1 max=10 step=0.01 const b = 3; // min=1 max=10 step=0.01 const steps = 631; //min=20 max=10000 step=1 const delta = Math.PI / 2; const stepSize = 0.01 // min=0.001 max=2 step=0.01 let t = 0; const turtle = new Turtle(); turtle.penup(); for(let i = 0; i < steps; i++) { t += stepSize; let x = scale * Math.sin(a * t + delta); let y = scale * Math.sin(b * t); turtle.goto(x, y); turtle.pendown(); }