diff options
| author | LLLL Colonq <llll@colonq> | 2026-07-31 05:00:49 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-07-31 05:00:49 -0400 |
| commit | ea5332e4a1a035e888709bee278fcafb182f7922 (patch) | |
| tree | 7e1520391e7f04fa3df425fd9ed02008f748cdfd /2026/games_submissions/crm148/util.js | |
| parent | 3ec03ba57474aa4320cb7901980b55706adbc111 (diff) | |
Update
Diffstat (limited to '2026/games_submissions/crm148/util.js')
| -rw-r--r-- | 2026/games_submissions/crm148/util.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/2026/games_submissions/crm148/util.js b/2026/games_submissions/crm148/util.js new file mode 100644 index 0000000..e91c5e4 --- /dev/null +++ b/2026/games_submissions/crm148/util.js @@ -0,0 +1,28 @@ +function randomAngle() { + return Math.random() * Math.PI * 2; +} + +function toDegrees(radians) { + return radians * 180 / Math.PI; +} + +function toDegreesInt(radians) { + return Math.floor(toDegrees(radians)); +} + +function normalizeAngle(radians) { + return (radians + Math.PI) % (2 * Math.PI) - Math.PI; +} + +function drawSquare(ctx, v2, size) { + const off = size / 2; + ctx.fillRect(v2.x - off, v2.y - off, size, size); +} + +export { + randomAngle, + toDegrees, + toDegreesInt, + normalizeAngle, + drawSquare, +} |
