xxxxxxxxxx
25
class Petal {
constructor(x, y, r) {
this.x = x;
this.y = y;
this.r = r;
this.c = 255;
}
display() {
fill(this.c);
circle(this.x, this.y, this.r);
}
hover(other) {
let d = dist(this.x, this.y, other.x, other.y);
if (mouseIsPressed) {
if (d <= this.r) {
this.c = 0;
}
} else {
this.c = 255;
}
}
}