Skip to content

Commit 0b5c7e0

Browse files
Fixed previous progress with linear cubic bezier (#494)
* Fixed previous progress with linear cb Co-authored-by: aborziak-ms <[email protected]>
1 parent 1909392 commit 0b5c7e0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

source/LottieToWinComp/Animate.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,15 @@ static void GenericCreateCompositionKeyFrameAnimation<TCA, T>(
682682
{
683683
// Ensure the previous expression doesn't continue being evaluated during the current keyframe.
684684
// This is necessary because the expression is only defined from the previous progress to the current progress.
685-
InsertKeyFrame(compositionAnimation, currentProgress, previousValue, context.ObjectFactory.CreateStepThenHoldEasingFunction());
685+
var nextLargerThanPrevious = Float32.NextLargerThan(previousProgress);
686+
InsertKeyFrame(compositionAnimation, nextLargerThanPrevious, previousValue, context.ObjectFactory.CreateStepThenHoldEasingFunction());
687+
688+
if (currentProgress <= nextLargerThanPrevious)
689+
{
690+
// Prevent the next key frame from being inserted at the same progress value
691+
// as the one we just inserted.
692+
currentProgress = Float32.NextLargerThan(nextLargerThanPrevious);
693+
}
686694
}
687695

688696
// The easing for a keyframe at 0 is unimportant, so always use Hold.

0 commit comments

Comments
 (0)