diff options
| author | julian laplace <julescarbon@gmail.com> | 2023-05-10 15:13:47 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2023-05-10 15:13:47 +0200 |
| commit | 7af6dfc46f9a94e3966cdfa4e0d353e989eb9070 (patch) | |
| tree | 10ba8c83dd83dde4ffa74ec4fd7ce0868f145b70 /src/lib/util.js | |
| parent | ec93f3236c39e03b993d0e15093ac354a20cb9ea (diff) | |
add stars and velocity
Diffstat (limited to 'src/lib/util.js')
| -rw-r--r-- | src/lib/util.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/util.js b/src/lib/util.js index 7980220..ff6dcf5 100644 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -11,6 +11,7 @@ const isDesktop = !isMobile; document.body.classList.add(isMobile ? "mobile" : "desktop"); export const browser = { isIphone, isIpad, isMobile, isDesktop }; +export const clamp = (n, a, b) => (n < a ? a : n < b ? n : b); export const choice = (a) => a[Math.floor(Math.random() * a.length)]; export const mod = (n, m) => n - m * Math.floor(n / m); export const random = () => Math.random(); |
