xxxxxxxxxx
34
/*
----- Coding Tutorial by Patt Vira -----
Name: Double Pendulum
Video Tutorial: https://youtu.be/OJSzIaRRxG8
Connect with Patt: @pattvira
https://www.pattvira.com/
----------------------------------------
*/
let g = 1; let pendulums = []; let num = 30;
let colorPallete = ["#abcd5e", "#14976b", "#2b67af", "#62b6de", "#f589a3", "#ef562f", "#fc8405", "#f9d531"];
function setup() {
createCanvas(400, 400);
for (let i=0; i<num; i++) {
let angle1 = PI/4 + i*0.001;
let angle2 = PI;
pendulums[i] = new Pendulum(angle1, angle2, 70, 70);
}
}
function draw() {
background(0, 0, 100, 30);
for (let i=0; i<num; i++) {
pendulums[i].update();
pendulums[i].display();
}
}