xxxxxxxxxx
35
class Ripple {
constructor(x, y) {
this.x = x;
this.y = y;
this.w = 0;
this.go = false;
this.angle = 0;
}
get h() {
return this.w / 3;
}
show() {
noFill();
strokeWeight(2);
stroke(255 - (this.w + 60));
ellipse(this.x, this.y, this.w, this.h);
}
grow() {
if (this.w > 150) {
this.go = false;
this.w = 0;
this.move();
}
this.w += 11;
}
move() {
this.angle += PI / 8;
this.x = width / 2 + cos(this.angle) * radius;
this.y = height / 2 + sin(this.angle) * radius;
}
}