var NUMBEROFCIRCLES = 10;
var carray = ["MediumVioletRed", "DeepPink", "PaleVioletRed", "HotPink", "LightPink", "Pink"];
sounds[0] = loadSound("noise1.mp3");
sounds[1] = loadSound("noise2.mp3");
sounds[2] = loadSound("noise3.mp3");
sounds[3] = loadSound("noise4.mp3");
sounds[4] = loadSound("noise5.mp3");
sounds[5] = loadSound("noise6.mp3");
sounds[6] = loadSound("noise7.mp3");
logo = loadImage("pngwing.png");
createCanvas(windowWidth, windowHeight);
for(let i = 0;i<NUMBEROFCIRCLES;i++)
ball.velocity = random(1, 5);
ball.angle = random(-PI, PI);
ball.color = random(carray);
ball.sound = floor(random(sounds.length));
for(let i = 0;i<NUMBEROFCIRCLES;i++)
ellipse(b[i].x, b[i].y, d, d);
image(logo, b[i].x, b[i].y, d, d);
b[i].x = b[i].x + b[i].velocity*cos(b[i].angle);
b[i].y = b[i].y + b[i].velocity*sin(b[i].angle);
if(b[i].x>width) b[i].angle = PI - b[i].angle;
if(b[i].x<0) b[i].angle = PI - b[i].angle;
if(b[i].y>height) b[i].angle = TWO_PI - b[i].angle;
if(b[i].y<0) b[i].angle = TWO_PI - b[i].angle;
if(b[i].x>width || b[i].x<0 || b[i].y>height || b[i].y<0)
sounds[b[i].sound].play();
b[i].sound = (b[i].sound+1) % sounds.length;
for(let j = 0;j<NUMBEROFCIRCLES;j++)
if(i!=j&&b[i].x>b[j].x-d&&b[i].x<b[j].x+d&&b[i].y>b[j].y-d&&b[i].y<b[j].y+d)
if(b[i].x>b[j].x) b[i].angle = PI - b[i].angle;
if(b[i].x<b[j].x) b[i].angle = PI - b[i].angle;
if(b[i].y>b[j].y) b[i].angle = TWO_PI - b[i].angle;
if(b[i].y<b[j].y) b[i].angle = TWO_PI - b[i].angle;
sounds[b[i].sound].play();
b[i].sound = (b[i].sound+1) % sounds.length;