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

Flick to dismiss causes animations to break #4

Closed
aveace opened this issue Jun 6, 2017 · 3 comments
Closed

Flick to dismiss causes animations to break #4

aveace opened this issue Jun 6, 2017 · 3 comments

Comments

@aveace
Copy link

aveace commented Jun 6, 2017

Flicking to dismiss view controllers breaks the animations. You can get stuck between two states. I was able to repro using Modal Transition example and Pinterest example easily.

  • Modal Example: Flick the icon up; notice animation is stuck.
  • Pinterest Example: Dismiss a view controller by flicking down. Again animation gets stuck.
  • I can provide video if you are not able to repro it. Other than this issue; it looks great; Awesome job by the team! keep it up!!
@toineheuvelmans
Copy link
Contributor

Hey @aveace, thanks for your feedback! I'll look into it a.s.a.p. to see if I can reproduce it.

@toineheuvelmans
Copy link
Contributor

I managed to reproduce the issue. The cause for the animation to get stuck is that after interaction (i.e. the flick), the animation layers are started or continued, depending on their animation range relative to the current fractionComplete (see animate(_:) in the TransitionDriver). There's one layer in particular for which it is essential that it continues: the progressLayerAnimator is a non-visible layer with a full animation range, added by the TransitionDriver to guarantee a layer that animates over the full length of the transition. This is the only animation layer (aside from the sharedElementAnimator) of which the completion is monitored by the completionCoordinator, an object that basically wraps a dispatch group, ensuring the overall transition completion is only called when everything is done.
Back to the animate(_:) function: that progressLayerAnimator will have a range that "contains" the current overall fractionComplete, and will be active because its fractionComplete has been adjusted and it has been paused the moment the interaction began (two reasons why a UIViewPropertyAnimator enters the active state). Therefore the TransitionDriver will call continueAnimation(...) on it. For a reason I do not yet understand, this doesn't always actually continue the animation. It seems that only with vigorous flicks the animation gets stuck, but all velocity-related properties are valid values (the velocity used in the AnimationTimingParameters, the fractionComplete upon moving to the animation phase, the durationFactor passed in continueAnimation(...)). Explicitly calling startAnimation() also doesn't make a difference.
Since the progressLayerAnimator isn't continued (nor is any other animation layer except the sharedElementAnimator), it never completes, and therefore the whole transition never completes.

I must say I'm unsure why this happens, and will continue to investigate in the moments I can spare time for it, which at the moment unfortunately isn't much. 🤞🏻

@toineheuvelmans
Copy link
Contributor

Release 1.1.0 packs several fixes for issues #5 #6 #1 which cover this issue too.

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

No branches or pull requests

2 participants