TLLayoutTransitioning icon indicating copy to clipboard operation
TLLayoutTransitioning copied to clipboard

Disable bounce effect in interactive transitions

Open jakunico opened this issue 9 years ago • 4 comments

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.

jakunico avatar Oct 06 '15 16:10 jakunico

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.

wtmoose avatar Oct 06 '15 19:10 wtmoose

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 !

jakunico avatar Oct 07 '15 18:10 jakunico

@wtmoose Have you found a solution?

AEugene avatar Feb 13 '17 15:02 AEugene

@AEugene no, I have not.

wtmoose avatar Feb 14 '17 16:02 wtmoose