createCanvas(windowWidth, windowHeight);
for(let i = 0; i <= NUM+1; i++){
vecLocation[i] = createVector(width/2, height/2);
vecVelocity[i] = createVector(random(-5, 5), random(-5, 5));
colorr[i] = random(0, 127);
colorg[i] = random(0, 255);
colorb[i] = random(127, 255);
diameter[i] = random(5, 15);
vecLocation[NUM] = createVector(0, height);
vecVelocity[NUM] = createVector(10, 20);
vecLocation[NUM+1] = createVector(width, 0);
vecVelocity[NUM+1] = createVector(-12, 17);
for(let i= 0; i <= NUM+1; i++){
ellipse(vecLocation[i].x, vecLocation[i].y, 100, 100);
ellipse(vecLocation[i].x, vecLocation[i].y, 100, 100);
fill(colorr[i], colorg[i], colorb[i], 200);
ellipse(vecLocation[i].x, vecLocation[i].y, diameter[i], diameter[i]);
vecLocation[i].add(vecVelocity[i]);
if(vecLocation[i].x > width || vecLocation[i].x < 0){
vecVelocity[i].x = vecVelocity[i].x * -1;
if(vecLocation[i].y > height || vecLocation[i].y < 0){
vecVelocity[i].y = vecVelocity[i].y * -1;
for(let i= 0; i < NUM; i++){
if(pow(vecLocation[i].x-vecLocation[NUM].x, 2) +
pow(vecLocation[i].y-vecLocation[NUM].y, 2) <= 2500){
vecVelocity[i] = createVector(random(-10, 10), random(-10, 10));
if(pow(vecLocation[i].x-vecLocation[NUM+1].x, 2) +
pow(vecLocation[i].y-vecLocation[NUM+1].y, 2) <= 2500){
vecVelocity[i] = createVector(random(-10, 10), random(-10, 10));
if(pow(vecLocation[NUM].x-vecLocation[NUM+1].x, 2) +
pow(vecLocation[NUM].y-vecLocation[NUM+1].y, 2) <= 2500){
for(let i = 0; i < NUM; i++){