Returns a function that interpolates between two points. If you just want to interpolate between two points, use interpolate.
const i = interpolator({ x:0, y:0 }, { x:10, y:10 });i(0.5); // Halfway { x, y } Copy
const i = interpolator({ x:0, y:0 }, { x:10, y:10 });i(0.5); // Halfway { x, y }
If you find yourself not needing to reuse the function because you're always calling interpolator with different point values all the time, use interpolate instead.
interpolator
Function to interpolate
Returns a function that interpolates between two points. If you just want to interpolate between two points, use interpolate.
If you find yourself not needing to reuse the function because you're always calling
interpolatorwith different point values all the time, use interpolate instead.