Closed conversun closed 3 years ago
Hi @conversun , there's a template for this kind of issues. The description doesn't offer enough information.
I've just run the Sample project and the animation seems fine:
This is customisable via pagingAnimation(_:)
. The default animation is easeOut(duration: 0.35)
@fermoya Sorry, I forgot to add device information
iPhone 12Pro 14.4.1 (14.4.0 Same exists)
This problem only occurs on real devices
@conversun @beeirl could you please try version 2.0.0
and lmk if the issue is reproducible in this version?
@fermoya 2.0.0
looks definitely way better. The animations are working. But if I use a custom animation and swipe faster it falls back to the default ease
animation. So I guess the problem is still there it just occurs in a different shape.
@beeirl I think I have a possible solution for this. I think PagerContent:224
should have the same animation as PagerContent:284
. When the swipe is too fast, SwiftUI seems to ignore the last animation
@fermoya oh yeah 100%
does that mean that you tried it @beeirl ?
@fermoya no I have not tested it but I have read through the code and in my opinion the current implementation reflects exactly the behavior I am experiencing.
@beeirl I just created this branch with a possible solution in case you want to point at it: https://github.com/fermoya/SwiftUIPager/tree/feat/dragging-animation
@fermoya It works like a charm. Thank you so much for taking care of that. Much appreciated.
@fermoya It works. Thank you
@fermoya I just stumbled over a bug - if you swipe and hold the animation starts going crazy. Seems like something is off with the drag change
@beeirl can you please show me a video?
bet! It happens if you swipe and hold.
EDIT:
this is how my draggingAnimation
looks like:
.draggingAnimation(.custom(animation: .spring(response: 0.3, dampingFraction: 0.8, blendDuration: 1)))
https://user-images.githubusercontent.com/9655723/113117581-e1c65100-920e-11eb-9146-abf80dec6ed3.MP4
@beeirl have you tried any other custom animation? Like an interactiveSpring
? I don't think you're supposed to use spring
in these scenario
@beeirl I think you need a different animation or a lower response. With interactiveSpring
that by default has a response of 0.15 you get a nice effect. Any other animation seems to be fine.
https://user-images.githubusercontent.com/22893221/112798364-61351280-909f-11eb-8016-b59c472a3a2c.mov