38 lines
881 B
JavaScript
38 lines
881 B
JavaScript
|
class Animation {
|
||
|
constructor(x, y, size) {
|
||
|
this.pos = new createVector(x, y);
|
||
|
this.x = x;
|
||
|
this.y = y;
|
||
|
this.size = size;
|
||
|
this.dots = [];
|
||
|
for (let i = 0; i < 20; i++) {
|
||
|
this.dots.push(new Dot(this.x, this.y, i, this.size));
|
||
|
}
|
||
|
};
|
||
|
|
||
|
update(f) {
|
||
|
for (let i = 0; i < 20; i++) {
|
||
|
this.dots[i].update(f);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
show() {
|
||
|
for (let i = 0; i < 20; i++) {
|
||
|
noFill();
|
||
|
stroke(230);
|
||
|
strokeWeight(2);
|
||
|
circle(this.x, this.y, this.size / 20 * (i + 1));
|
||
|
this.dots[i].show();
|
||
|
}
|
||
|
push();
|
||
|
stroke(55);
|
||
|
strokeWeight(3);
|
||
|
beginShape();
|
||
|
for (let i = 0; i < 20; i++) {
|
||
|
vertex(this.dots[i].pos.x, this.dots[i].pos.y);
|
||
|
}
|
||
|
endShape();
|
||
|
pop();
|
||
|
}
|
||
|
|
||
|
}
|