createCanvas(windowWidth, windowHeight);
for(let i = 0; i < ball_num; i++){
vecLocation[i] = createVector(width / 2, height / 2);
vecVelocity[i] = createVector(random(-10, 10), random(-10, 10));
type[i] = int(random(0, 3));
for(let i = 0; i < ball_num; i++){
for(let i = 0; i < circle_num; i++){
circle[i] = height/3*(i+1);
circle[i] = width/3*(i+1);
for(let i = circle_num; i > 0; i--){
ellipse(width/2, height/2, circle[i-1], circle[i-1]);
for(let i = 0; i < ball_num; i++){
fill(255, 255, 150, 127);
fill(255, 150, 150, 127);
vecLocation[i].add(vecVelocity[i]);
ellipse(vecLocation[i].x, vecLocation[i].y, ball_size[i], ball_size[i]);
if(pow((width/2 - vecLocation[i].x), 2) + pow((height/2 - vecLocation[i].y), 2)
>= pow((circle[0]/2-ball_size[i]/2), 2)){
vecVelocity[i].x = vecVelocity[i].x * -1;
vecVelocity[i].y = vecVelocity[i].y * -1;
if(pow((width/2 - vecLocation[i].x), 2) + pow((height/2 - vecLocation[i].y), 2)
> pow((circle[1]/2-ball_size[i]/2), 2)){
vecVelocity[i].x = vecVelocity[i].x * -1;
vecVelocity[i].y = vecVelocity[i].y * -1;
if(pow((width/2 - vecLocation[i].x), 2) + pow((height/2 - vecLocation[i].y), 2)
>= pow((circle[1]/2-ball_size[i]/2), 2)
|| pow((width/2 - vecLocation[i].x), 2) + pow((height/2 - vecLocation[i].y), 2)
< pow((circle[0]/2+ball_size[i]/2), 2)){
vecVelocity[i].x = vecVelocity[i].x * -1;
vecVelocity[i].y = vecVelocity[i].y * -1;
if(pow((width/2 - vecLocation[i].x), 2) + pow((height/2 - vecLocation[i].y), 2)
> pow((circle[2]/2-ball_size[i]/2), 2)){
vecVelocity[i].x = vecVelocity[i].x * -1;
vecVelocity[i].y = vecVelocity[i].y * -1;
if(pow((width/2 - vecLocation[i].x), 2) + pow((height/2 - vecLocation[i].y), 2)
>= pow((circle[2]/2-ball_size[i]/2), 2)
|| pow((width/2 - vecLocation[i].x), 2) + pow((height/2 - vecLocation[i].y), 2)
< pow((circle[1]/2+ball_size[i]/2), 2)){
vecVelocity[i].x = vecVelocity[i].x * -1;
vecVelocity[i].y = vecVelocity[i].y * -1;