JSPM

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

lerps two numbers or an array of numbers

Package Exports

  • lerp-array

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 (lerp-array) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lerp-array

stable

Quickly lerps two numbers or two parallel arrays of numbers (e.g. vectors, colors, etc).

var lerp = require('lerp-array')

//RGB colors
var color1 = [0, 255, 0]
var color2 = [255, 0, 0]

//lerp the two
var color3 = lerp(color1, color2, 0.5)

Usage

NPM

lerp(v1, v2, t[, out])

Linearly interpolates v1 to v2 using the t component. If both v1 and v2 are number types, this is equivalent to a straight lerp. If the two are array types, they are lerped in parallel. This assumes both arrays are the same length (only uses the length of v1).

You can optionally specify an out parameter to re-use an array object. Otherwise, a new one will be created.

If the two arrays have different sizes, the length of the smallest will prevail.

License

MIT, see LICENSE.md for details.