Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //http://www.openframeworks.cc/documentation/math/ofMath.html#show_ofMap
- function ofMap(value, r1a, r1b, r2a, r2b, clamp){
- if (clamp && value<=r1a)
- return r2a;
- if (clamp && value>=r1b)
- return r2b;
- var r1 = r1b-r1a;
- var r2 = r2b-r2a;
- return r2a+(value-r1a)*r2/(r1b-r1a)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement