double pendulum drawing
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 e = 2.71828;
turtle.penup();
//turtle.goto(0,0);
const scale = 30 //min=1 max=50 step=1
const p1 = 1; // min=0 max=1.5708 step=0.1;
const f1 = 1; // min=0 max=10 step=0.1;
const d1 = 0; // min=-0.1 max=0.1 step=0.001;
const p2 = 1; // min=0 max=1.5708 step=0.1;
const f2 = 1; // min=0 max=10 step=0.1;
const d2 = 0; // min=-0.1 max=0.1 step=0.001;
const p3 = 1; // min=0 max=1.5708 step=0.1;
const f3 = 1; // min=0 max=10 step=0.1;
const d3 = 0; // min=-0.1 max=0.1 step=0.001;
const p4 = 1; // min=0 max=1.5708 step=0.1;
const f4 = 1; // min=0 max=10 step=0.1;
const d4 = 0; // min=-0.1 max=0.1 step=0.001;
// The walk function will be called until it returns false.
function walk(step) {
i = step/100
var x = Math.sin(f1*i + p1)*(e**(-d1*i)) + Math.sin(f2*i + p2)*(e**(-d2*i));
var y = Math.sin(f3*i + p3)*(e**(-d3*i)) + Math.sin(f4*i + p4)*(e**(-d4*i));
turtle.goto(scale*x,scale*y);
turtle.pendown();
return step < 10000;
}