// Cloned by Octavian on 30 Nov 2022 from World "Tutorial 7.5 (0)" by "Coding Train" project // Please leave this clone trail here.
let bubbles =[];function setup(){
createCanvas(600,400);for(let i =0; i <10; i++){
let x = random(width);
let y = random(height);
let r = random(20,60);
let b =newBubble(x, y, r);
bubbles.push(b);}}function draw(){
background(0);for(let i =0; i < bubbles.length; i++){
bubbles[i].rollover(mouseX, mouseY);
bubbles[i].move();
bubbles[i].show();}}classBubble{
constructor(x, y, r){this.x = x;this.y = y;this.r = r;this.brightness =0;}
rollover(px, py){
let d = dist(px, py,this.x,this.y);if(d <this.r){this.brightness =255;}else{this.brightness =0;}}
move(){this.x =this.x + random(-2,2);this.y =this.y + random(-2,2);}
show(){
stroke(255);
strokeWeight(4);
fill(this.brightness,125);
ellipse(this.x,this.y,this.r *2);}}