JSPM

unlerp

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 151
  • Score
    100M100P100Q86647F
  • License MIT

opposite of lerp; get normalized range between two bounds

Package Exports

  • unlerp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unlerp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.