26 lines
591 B
JavaScript
Executable File
26 lines
591 B
JavaScript
Executable File
class Dot {
|
|
constructor(x, y, num, size) {
|
|
this.pos = new createVector(x, y);
|
|
this.x = x;
|
|
this.y = y;
|
|
this.n = num;
|
|
this.s = size;
|
|
this.ang = 0;
|
|
|
|
angleMode(DEGREES);
|
|
};
|
|
|
|
update(f) {
|
|
this.pos = new createVector(this.x, this.y)
|
|
this.pos.add(p5.Vector.fromAngle(radians(this.ang), this.s / 2 / 20 * (this.n + 1)));
|
|
this.ang += 360/144*(this.n + 1)/12;
|
|
}
|
|
|
|
show() {
|
|
push()
|
|
strokeWeight(6);
|
|
stroke(200, 50, 50);
|
|
point(this.pos.x, this.pos.y);
|
|
pop();
|
|
}
|
|
} |