xxxxxxxxxx
let vecLocation = [];
let vecVelocity = [];
let bigger;
const NUM = 255;
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(60);
for(let i = 0; i < NUM; i++){
vecLocation[i] = createVector(width/2, height/2);
vecVelocity[i] = createVector(random( -30, 30), random(-30, 30));
bigger = random(6.00, 10.00)
}
}
function draw() {
background(255);
noStroke();
for(let i = 0; i < NUM; i++){
ellipse(vecLocation[i].x, vecLocation[i].y, bigger, bigger);
vecLocation[i].add(vecVelocity[i]);
if(vecLocation[i].x > width || vecLocation[i].x < 0) { //OR
vecVelocity[i].x = vecVelocity[i].x * random(-1.100, -0.500);
}
if(vecLocation[i].y > height || vecLocation[i].y < 0) { //OR
vecVelocity[i].y = vecVelocity[i].y * random(-1.100, -0.500);
}
fill(random(255), random(255),random(255),random(255.00));
}
}