fix(interpolation): fix bezier interpolation between same values #2841
+8
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've reported issue #2840
This PR solves this value.
Change is pretty small but maybe not obvious why it is legal here to multiply curve value with 1.
So, as we know according lottie docs keyframe describes easing handling (cubic bezier) between current keyframe and next keyframe values.
It contains 2 base points with coordinates [0,0] [1,1], and control points are stored in
in
,out
properties.This is regular example how it can look like https://cubic-bezier.com/#.2,1.44,.7,.31
Let's say we are animating between values [10, 20]
It's easy to interpolate.
And it's obvious that when percentage is 100 newVal is
which make sense;
In our case we are interpolating between same value;
which actually means that [1,1] point is equal to [1,0] point because there is no difference between values.
In this case curve describes increment itself.