Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private const val MAX_SCALE = 1.0f
- private const val MIN_SCALE = 0.8f
- class ZoomOutSlideTransformer : ViewPager.PageTransformer {
- override fun transformPage(page: View, pos: Float) {
- val position = when {
- pos < -1 -> -1f
- pos > 1 -> 1f
- else -> pos
- }
- val tempScale = if (position < 0) 1 + position else 1 - position
- val slope = (MAX_SCALE - MIN_SCALE) / 1
- val scaleValue = MIN_SCALE + tempScale * slope
- page.scaleX = scaleValue
- page.scaleY = scaleValue
- }
- }
Add Comment
Please, Sign In to add comment