Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where Trim strokeStart / strokeEnd could be rendered in incorrect order #2049

Merged
merged 5 commits into from
Apr 27, 2023

Conversation

calda
Copy link
Member

@calda calda commented Apr 26, 2023

This PR fixes an issue where Trim strokeStart / strokeEnd values could be rendered in an incorrect order.

Core Animation requires that strokeStart always be less than or equal to strokeEnd. Previously we only handled cases where strokeStart was either always greater than or always less than strokeEnd. Now we also handle cases where strokeStart and strokeEnd swap places some time during the animation. Fixes #1972.

Before After
Simulator Screenshot - iPhone 8 - 2023-04-26 at 16 45 57 Simulator Screenshot - iPhone 8 - 2023-04-26 at 16 45 28

// Otherwise if the start / end values ever swap places we have to
// fix the order on a per-keyframe basis, which may require manually
// interpolating the keyframe values at each frame.
(strokeStart, strokeEnd) = interpolatedAtEachFrame()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice use of dual assignment!

@calda calda enabled auto-merge (squash) April 27, 2023 18:41
@calda calda merged commit 939613e into master Apr 27, 2023
10 checks passed
@calda calda deleted the cal--1972 branch April 27, 2023 18:43
iago849 pushed a commit to atteamapps/lottie-ios that referenced this pull request Feb 8, 2024
MoroziOS pushed a commit to MoroziOS/tmg-lottie-ios that referenced this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected Trim animation behaviour
2 participants