xxxxxxxxxx
26
let t1, newTriangle;
let shapeList = []
let frames = 60;
let time = 0
const TIME_TRIANGLE = 60* 4
function setup() {
createCanvas(400, 240);
shapeList.push(new Triangle(30, width/2, height/2, shapeList.length % 2 !== 0 ? "black" : "white"))
// saveGif('myAnim.gif', 8)
}
function draw() {
background(0);
const executedTime = Math.floor(frameCount/TIME_TRIANGLE)
if(executedTime > time){
time = executedTime
shapeList.push(new Triangle(30, width/2, height/2, shapeList.length % 2 !== 0 ? "black" : "white"))
}
shapeList.forEach(s => {
s.draw();
})
}