class CubeTransformer : ViewPager.PageTransformer {
override fun transformPage(view: View, position: Float) {
val deltaY = 0.5F
view.pivotX = if (position < 0F) view.width.toFloat() else 0F
view.pivotY = view.height * deltaY
view.rotationY = 45F * position
}
}
Last active
November 21, 2021 09:45
-
-
Save delacrixmorgan/6b05ab74d1acb01b471fcc3151d70703 to your computer and use it in GitHub Desktop.
Cube ViewPager Transformer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you! This is so simple and works beautifully. (I couldn't find this anywhere else.)
Here it is with ViewPager2 and Java for anyone looking for it:
And then in your activity: