class Circle {
constructor({x, y, r, color}) {
this.x = x;
this.y = y;
this.r = r;
this.color = color;
}
distance({x, y}) {
return Math.hypot(this.x - x, this.y - y);
}
render(context) {
context.beginPath();
context.moveTo(this.x + this.r, this.y);
context.arc(this.x, this.y, this.r, 0, 2 * Math.PI);
context.fillStyle = this.color;
context.fill();
if (this.active) {
context.lineWidth = 1;
context.stroke();
}
}
}