summaryrefslogtreecommitdiff
path: root/app/client/util.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-02 20:44:46 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-02 20:44:46 +0200
commitfdf927db614a1e7696688b6e39c2bdb7548a72cc (patch)
tree1c8e3cf64dfa4275e0526265f296b376c2c1b827 /app/client/util.js
parent01cda57ffd9edc0a3f53501399c134815232e4b5 (diff)
loss report
Diffstat (limited to 'app/client/util.js')
-rw-r--r--app/client/util.js7
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)'