summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--instructions.html2
-rw-r--r--js/util.js6
2 files changed, 5 insertions, 3 deletions
diff --git a/instructions.html b/instructions.html
index 2767e48..fb522c0 100644
--- a/instructions.html
+++ b/instructions.html
@@ -29,7 +29,7 @@ E, PI, PHI
<u>convenience functions</u>
clamp(n,min,max)
mix(n,a,b) (lerp)
-step(n,a,b)
+step(a,b)
smoothstep(n,a,b)
avg(m,n,a)
cosp, sinp (mapped to [0,1])
diff --git a/js/util.js b/js/util.js
index b728377..46943f9 100644
--- a/js/util.js
+++ b/js/util.js
@@ -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);