inspired from
paulbourke.net/geometry/harmonograph/
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 wx=6; // min=0, max=50, step=1
const ws=9; // min=0, max=50, step=1
const wy=21; // min=0, max=50, step=1
const px=8; // min=0, max=50, step=1
const ps=13; // min=0, max=50, step=1
const py=10; // min=0, max=50, step=1
const ax=17; // min=0, max=50, step=1
const ay=21; // min=0, max=50, step=1
const as=13; // min=0, max=50, step=1
const scale=3; // min=0, max=10, step=.1
const maxiter=1500; // min=0, max=5000, step=1
const stepwidth=1; // min=1, max=10, step=1
x=(ax*Math.sin(wx*0+px)+as*Math.sin(ws*0+ps))*scale;
y=(ay*Math.sin(wy*0+py))*scale
turtle.penup();
turtle.goto(x,y);
turtle.pendown();
// The walk function will be called until it returns false.
function walk()
{
for(t=0;t<maxiter;t=t+stepwidth)
{
x=(ax*Math.sin(wx*t+px)+as*Math.sin(ws*t+ps))*scale
y=(ay*Math.sin(wy*t+py))*scale
turtle.goto(x,y);
}
}