xxxxxxxxxx
25
class Mover {
constructor(x, y) {
this.pos = createVector(x, y);
this.r = 16;
}
randomVector() {
let mouse = createVector(mouseX, mouseY);
mouse.sub(this.pos);
mouse.setMag(2);
return mouse;
}
update() {
let v = this.randomVector();
this.pos.add(v);
}
show() {
stroke(255);
strokeWeight(2);
fill(255, 100);
ellipse(this.pos.x, this.pos.y, this.r * 2);
}
}