Skip to content

opposite of lerp; get normalized range between two bounds

License

Notifications You must be signed in to change notification settings

mattdesl/unlerp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

browser support

unlerp

frozen

Opposite of lerp; gets the range between a lower and upper bound.

var range = require('unlerp')

//result is typically between 0.0 and 1.0
var result = range(0, 50, 25) //=> 0.5

//if you want to saturate to 0.0 - 1.0
result = require('clamp')(result, 0, 1)

The result is not clamped.

Usage

NPM

range(min, max, value)

Produces the normalized range of value between two bounds. Equivalent to:

(value - min) / (max - min)

License

MIT, see LICENSE.md for details.

About

opposite of lerp; get normalized range between two bounds

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published