Open pronebird opened 9 years ago
This doesn't sound like a very typical use case, could you elaborate a little more? Would you want to adjust the deceleration rate or the input velocity? What you describe should all be possible, though perhaps it's just a matter of exposing some helper functions.
@kimon
I've been trying to crack the algorithm but without any success. I would really appreciate any help here.
I have a custom collection view with custom scroll view. Collection is represented by equal size elements (photos) that cover the whole screen. So when user pans the view and accelerates scroll, I'd like it stop at the photo that covers most of the screen at target position where decay supposed to stop. So it requires a little adjustment to whether velocity or deceleration to make it happen.
Thankfully POPDecayAnimation.toValue
gives me a hint regarding where it goes to, and I use this value to find the coordinate of nearest element at that position. This is very similar to functionality of UICollectionView.targetContentOffsetForProposedContentOffset
.
Right now I use a less smart solution, I follow the decay and when it gets slow enough, I swap it to spring animation and bounce it to desired location. But certainly this looks much cheaper than if decay would stop at specific coordinate.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
+1
Hi,
I am trying to adjust POPDecayAnimation to stop at desired point. Since I cannot specify
toValue
directly I have to find some other way how to make it stop at desired position by adjusting different parameters on animation. But apparently there are lots of factors at play so I cannot simply adjust velocity by taking a difference between target and desired coordinates.Is there any way to do the reverse calculation?
Similar to #207