diff options
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)' |
