I want to achieve a cube animation effect when swiping ViewPager fragments. like this:
I'm using this code to achieve that:
class CubeOutTransformer : ViewPager2.PageTransformer {
override fun transformPage(page: View, position: Float) {
val deltaY = 0.5F
page.pivotX = if (position < 0F) page.width.toFloat() else 0F
page.pivotY = page.height * deltaY
page.rotationY = 45F * position
}
}
But my current effect is like this:
As you can see there's a huge gap between fragments when swiping and It's not like a cube animation which I'm looking for. How can I remove this gap? Thanks
from How to remove gap between fragmetns in ViewPager when applying a Cube Page Transformer
No comments:
Post a Comment