xxxxxxxxxx
39
let candyX = [];
let candyY = [];
let candyXS = [];
let candyYS = [];
function setup() {
createCanvas(windowWidth, windowHeight);
// frameRate(24);
for (let i = 0; i < 160; i++) {
candyX.push(random(100, 200));
candyY.push(random(100, 300));
candyXS.push(random(.1, 2));
candyYS.push(random(.1, 2));
}
}
let howMany = 0;
function draw() {
background(245, 245, 245);
textSize(28);
for(let i = 0; i < candyX.length; i++) { // loop to display all of the circles
text("🍬", candyX[i], candyY[i]);
}
for(let i = 0; i < howMany; i++) {
candyX[i] += candyXS[i];
candyY[i] += candyYS[i];
}
if (frameCount % 20 === 0) {
howMany++;
console.log(howMany);
}
}