Usage
As mentioned in the introduction, interpolation is very often applied in an animation loop, slowly nudging a value to some target value. We adjust the interpolation ‘amount’ value to set how quickly the target should be reached.
Interpolators
Using the Numbers.interpolate function alone, we would have to keep track of current value, target value and the amount to interpolate by.
To simplify, there are two interpolators - Numbers.interpolatorStepped and Numbers.interpolatorInterval - which help by wrapping all this up. They keep track of interpolation progress and return a function which simply yields the current value.
Like interpolate
you can use custom start and points:
When interpolation has completed, the function will just keep returning the final value.
The stepped version increments each time it is called. This means that the rate by which you call it determines how quickly the range completes.
Alternatively, use Numbers.interpolatorInterval . Rather than an amount to increment by, the first parameter is the time to progress through the range.