xxxxxxxxxx
28
class Flower {
constructor(cr, f, speed) {
this.x = [];
this.y = [];
this.fr = [];
this.f = f;
this.cr = cr;
this.speed = speed;
this.angle = 0;
}
display() {
push();
blendMode(DIFFERENCE);
noStroke();
fill(255);
beginShape();
for (let i=0; i<pts; i++) {
this.fr[i] = this.f*cos(period*360*i/pts);
this.x[i] = (this.cr+this.fr[i])*cos(i/pts*360 + this.angle);
this.y[i] = (this.cr+this.fr[i])*sin(i/pts*360 + this.angle);
vertex(this.x[i], this.y[i]);
}
endShape(CLOSE);
pop();
this.angle += this.speed;
}
}