diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-02 20:44:46 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-02 20:44:46 +0200 |
| commit | fdf927db614a1e7696688b6e39c2bdb7548a72cc (patch) | |
| tree | 1c8e3cf64dfa4275e0526265f296b376c2c1b827 /app/client/util.js | |
| parent | 01cda57ffd9edc0a3f53501399c134815232e4b5 (diff) | |
loss report
Diffstat (limited to 'app/client/util.js')
| -rw-r--r-- | app/client/util.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/client/util.js b/app/client/util.js index 2ba6d3f..34fa023 100644 --- a/app/client/util.js +++ b/app/client/util.js @@ -10,7 +10,12 @@ htmlClassList.remove('loading') // window.debug = false -function randint(n) { return Math.floor(Math.random()*n) } +export function clamp(n,a,b) { return n<a?a:n<b?n:b } +export function norm(n,a,b) { return (n-a) / (b-a) } +export function lerp(n,a,b) { return (b-a)*n+a } +export function mix(n,a,b) { return a*(1-n)+b*n } +export function randint(n) { return Math.floor(Math.random()*n) } +export function randrange(a,b){ return Math.random() * (b-a) + a } document.body.style.backgroundImage = 'linear-gradient(' + (randint(40)+40) + 'deg, #fde, #ffe)' |
