xxxxxxxxxx
38
var splash = [];
let objectsplash;
function setup() {
createCanvas(400, 400);
frameRate(60);
}
function mousePressed(){
objectsplash = new Splash(mouseX,mouseY);
splash.push(objectsplash);
}
function draw() {
background(220);
for (let i = 0; i < splash.length; i++) {
splash[i].pop();
}
}
class Splash {
constructor(x,y){
this.x = x;
this.y = y;
this.r = 0;
this.opacity = 225;
}
pop() {
noFill();
stroke(0, this.opacity);
circle(this.x, this.y, this.r);
this.r += 2;
this.opacity = this.opacity - 3;
}
}