mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-11 09:11:50 +00:00
22 lines
544 B
TypeScript
22 lines
544 B
TypeScript
// Converts from degrees to radians.
|
|
Math.radians = function (degrees: number): number {
|
|
return (degrees * Math.PI) / 180.0;
|
|
};
|
|
|
|
// Converts from radians to degrees.
|
|
Math.degrees = function (radians: number): number {
|
|
return (radians * 180.0) / Math.PI;
|
|
};
|
|
|
|
// Begins a path and draws a circle.
|
|
CanvasRenderingContext2D.prototype.beginCircle = function (x: number, y: number, r: number): void {
|
|
this.beginPath();
|
|
|
|
if (r < 0.05) {
|
|
this.rect(x, y, 1, 1);
|
|
return;
|
|
}
|
|
|
|
this.arc(x, y, r, 0, 2.0 * Math.PI);
|
|
};
|