Closed facelessuser closed 2 years ago
Correction, even in linear, the extrapolation is considered an extension of the first or last piece in a piecewise interpolation, so yes, even an easing function that extends past the entire interpolation range on the first or last segment will trigger linear interpolation when working with splines. This is less jarring than having the end mirror in the last segment and then turn into linear interpolation when absolute t
is outside that segment.
I had forgotten we had that check in the code already.
When extrapolating past the end of a clamped spline, the intention is for the interpolation to continue, but in a linear fashion. While this currently works, sort of, the results are somewhat stunted. This is because we are still using the spline logic, but forcing the interpolation by stacking multiple endpoints. This is great for guiding a spline through its endpoint, but not necessarily to extend it past the end.
We can see here our stunted extrapolation:
But the fix is simple. For any initial
t
(not counting what happens after an easing function) that is beyond the [0, 1] range, we can simply use linear interpolation between the last 2 control points. This will extend the line in a linear fashion. And due to the way the endpoints are clamped, this should have the slopes matching just fine.