Last active
September 8, 2022 05:05
-
-
Save meet30997/b2407aa299804a138b89a33359b44543 to your computer and use it in GitHub Desktop.
Scale Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun View.scale( | |
alpha: Float = 0f, | |
scaleBy: Float = 1f, | |
duration: Long = 0L, | |
startingDelay: Long = 0 | |
) { | |
animate().alpha(alpha).scaleX(scaleBy).scaleY(scaleBy) | |
.setStartDelay(startingDelay) | |
.setDuration(duration).start() | |
} | |
// Initial Scale | |
binding.bannerPager.scale(0f, 0f, 0L) | |
binding.smallBannerPager.scale(0f, 0f, 0L) | |
binding.subCategoryRv.scale(0f, 0f, 0L) | |
//Start Animation | |
val duration = 500L | |
val startOffSet = 300L | |
binding.bannerPager.scale( | |
1f, | |
1f, | |
duration, | |
startOffSet | |
) | |
binding.smallBannerPager.scale( | |
1f, | |
1f, | |
duration, | |
startOffSet + 150 | |
) | |
binding.subCategoryRv.scale( | |
1f, | |
1f, | |
duration, | |
startOffSet + 300 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment