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

Disable bounce effect in interactive transitions #27

Open
jakunico opened this issue Oct 6, 2015 · 4 comments
Open

Disable bounce effect in interactive transitions #27

jakunico opened this issue Oct 6, 2015 · 4 comments

Comments

@jakunico
Copy link

jakunico commented Oct 6, 2015

Hi!

There seems to be a bounce effect when you complete an interactive transition, I'd like to replace that by just decelerating to final position without bouncing.

You can check this effect in the Example project, if you pinch and release it'll complete the interactive transition with a bounce effect going a bit further than final progress in some cases.

The workaround I found is to subclass TLTransitionLayout and override the setProgress:time: method limiting values to 0..1

- (void)setTransitionProgress:(CGFloat)transitionProgress time:(CGFloat)time
{
    [super setTransitionProgress:MAX(0, MIN(transitionProgress, 1.f)) time:MAX(0, MIN(time, 1.f))];
}

This does get rid for the bounce effect (it's no longer visible to the user) but the transition still takes some time to complete because it thinks it's bouncing.

Any idea how can I solve this issue?

Thanks in advance,

Nicolás.

@wtmoose
Copy link
Member

wtmoose commented Oct 6, 2015

The underlying problem with this is that this bounce comes from UIKit. What I mean is, when you finish or cancel the transition, UIKit drives the progress to completion and bounces the value beyond [0, 1] as it sees fit (as far as I can tell from experimentation). To eliminate the bounce cleanly, we would need to know the bounce formula in order to counteract it.

So I don't have a better idea than what you're already doing.

You might be interested in looking at #25, which talks about discrete jumps at the end of the transition. The underlying cause is that TLLayoutTransitioning truncates progress between [0, 1] like you've done above in some calculations but not others. I'm in the process of removing all of this truncation to resolve #25, but I don't think this will affect your workaround.

@jakunico
Copy link
Author

jakunico commented Oct 7, 2015

I see. I spent some hours looking for a workaround without success. It's a minor issue in our app so we're just going to focus on other stuff for now. Will update if I get to work on this again.

Thanks !

@AEugene
Copy link

AEugene commented Feb 13, 2017

@wtmoose Have you found a solution?

@wtmoose
Copy link
Member

wtmoose commented Feb 14, 2017

@AEugene no, I have not.

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

3 participants