lerp-array
Quickly lerps two numbers or two parallel arrays of numbers (e.g. vectors, colors, etc).
var lerp = //RGB colorsvar color1 = 0 255 0var color2 = 255 0 0 //lerp the twovar color3 =
Usage
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.