xxxxxxxxxx
47
var ripples = [];
var start = false;
function setup() {
createCanvas(600, 600);
if (start == true) {
for (let i = 0; i < 1; i++) {
ripples.push(new Ripple());
}
}
}
class Ripple {
constructor(x, y) {
this.x = x;
this.y = y;
this.diameter = random(15, 30);
}
newRipple() {
this.diameter += 5;
}
display() {
ellipse(this.x, this.y, this.diameter, this.diameter);
}
}
function draw() {
background(15, 100, 160, 50);
noFill();
strokeWeight(5);
stroke(230);
for (let i = 0; i < ripples.length; i++) {
ripples[i].newRipple(mouseX, mouseY);
ripples[i].display();
}
}
function mousePressed() {
start == true
for (let i = 0; i < 1; i++) {
ripples.push(new Ripple(mouseX, mouseY));
}
}