xxxxxxxxxx
let balls = [];
//let position;
//let velocity;
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
for(let i = 0; i < 50; i++){
position = createVector(random(0,width), random(0,height));
velocity = createVector(random(-10,10), random(-10,10));
let b = new Ball(position.x, position.y, velocity.x, velocity.y);
balls.push(b);
}
}
function draw() {
background(255);
for(let i = 0; i < balls.length; i++){
balls[i].move();
balls[i].show();
if(mouseIsPressed){
balls[i].gravitate(mouseX,mouseY);
}
}
}