diff options
Diffstat (limited to 'js/util.js')
| -rw-r--r-- | js/util.js | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -56,9 +56,11 @@ function dist(x0,y0,x1,y1){ return sqrt(pow(x1-x0,2)+pow(y1-y0,2)) } function angle(x0,y0,x1,y1){ return atan2(y1-y0,x1-x0) } function avg(m,n,a){ return (m*(a-1)+n)/a } -function step (n,a,b) { - return clamp((n - a) / (b - a), 0.0, 1.0); +function step(a, b){ + return (b >= a) + 0 + // ^^ bool -> int } + // hermite curve apparently function smoothstep(n,a,b){ var t = clamp((n - a) / (b - a), 0.0, 1.0); |
