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 AnimationView.Stop() #1157

Merged
merged 2 commits into from
Apr 23, 2020
Merged

Fix AnimationView.Stop() #1157

merged 2 commits into from
Apr 23, 2020

Conversation

7jason
Copy link
Contributor

@7jason 7jason commented Mar 25, 2020

This fixes #970. That issue was not actually resolved.

And also fixes #975

Before this change, calling stop() on an AnimationView that is playing did not work properly. It would not return to the first frame of the animation. And when it did, it would "reverse" the animation.

The reversing is because this PR put CATransaction.setCompletionBlock outside the CATransaction begin/commit block. CATransaction.setCompletionBlock needs to occur between CATransaction.begin and CATransaction.commit.

This PR moves that setCompletionBlock to the correct place.

After moving that code block, the animation would still not return to frame 0 when stop is called, but when a subsequent animation is play()'d, the animation would return to frame 0 without reversing.

It seemed clear to me, based on this behaviour, that some of the CATransaction stuff or the setNeedsDisplay() system is not working properly.

To remedy this, I have put a flush() in stop().

This fixes the problem. But I realize that the flush shouldnt need to be there. There are some deeper bugs in lottie-ios, but at least this fixes the symptom.

Tagging @buba447 @dcramps @ferico55 @thedrick

@liulichao123
Copy link

liulichao123 commented Mar 30, 2020

I also found this problem before, and it seems to have something to do with the keyword ‘@NSManaged’
#1130

@buba447 buba447 merged commit 01bf9b2 into airbnb:master Apr 23, 2020
@Nooba Nooba mentioned this pull request Nov 24, 2020
5 tasks
@Kaelzs Kaelzs mentioned this pull request Jan 29, 2021
calda pushed a commit that referenced this pull request Nov 28, 2022
Fix AnimationView.Stop()
calda pushed a commit that referenced this pull request Dec 1, 2022
Fix AnimationView.Stop()
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.

call stop() to reset animation without reverse animation in visual! Stop not rewinding animation visually
3 participants