CosmicMind / Motion

A library used to create beautiful animations and transitions for iOS.

Home Page:http://cosmicmind.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stop and remove all animations

Banck opened this issue · comments

Hello!
How can I remove all animations from my view?
I've tried to do
myView.layer.removeAllAnimations()
But seems it doesn't work properly. I've found method removeAllMotionAnimations in your extension for CALayer, but it is marked as internal.

Um, as I see removeAllMotionAnimations just removes all animations from layer, which have prefix "motion". So removeAllAnimations() should works fine, seems my issue in something else.

I've tried to do

myView.animate(MotionAnimation.fadeOut, MotionAnimation.duration(5), MotionAnimation.completion {
})
myView.layer.removeAllAnimations()

but myView did the animation anyway.

Hey! Try development branch, the issue is fixed in 14e27b9 I believe. View is updated and animations are removed on completion so everything stays in sync.

The reason for myView.layer.removeAllAnimations() not removing the animations is that they are not added yet. animate() queues animations to be added in main thread.

Thank you @OrkhanAlikhanov, @Banck if you need further help, please reopen or create a new issue.