Calculates a point in-between a
and b
.
If an interpolation amount below 0 or above 1 is given, and
allowOverflow_ is true, a point will be returned that is extended past
line`. This is useful for easing functions which might
briefly go past the limits.
import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'
// Get {x,y} at 50% along line
Lines.interpolate(0.5, line);
// Get {x,y} at 80% between point A and B
Lines.interpolate(0.8, ptA, ptB);
Point between a and b
Calculates a point in-between line
's start and end points.
import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'
// Get {x, y } at 50% along line
Lines.interpolate(0.5, line);
Any additional properties from b
are returned on the result as well.
0..1
Line
Optional
allowOverflow: booleanIf true, interpolation amount is permitted to exceed 0..1, extending the line
Calculates a point in-between a line's start and end points.
Param: amount
Interpolation amount
Param: aOrLine
Line, or first point
Param: pointBOrAllowOverflow
Second point (if needed) or allowOverflow.
Param: allowOverflow
If true, interpolation amount is permitted to exceed 0..1, extending the line.
Returns