-
-
Save itsSiddharthGupta/d934cf90ed70cbcdf20bd583b76628dd to your computer and use it in GitHub Desktop.
Pulsating Modifier
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
@Composable | |
fun Modifier.pulsatingScale( | |
pulseFraction: Float = 1.2f, | |
duration: Int = 1000 | |
): Modifier { | |
val infiniteTransition = rememberInfiniteTransition() | |
val scale = infiniteTransition.animateFloat( | |
initialValue = 1f, | |
targetValue = pulseFraction, | |
animationSpec = infiniteRepeatable( | |
animation = tween(duration), | |
repeatMode = RepeatMode.Reverse | |
) | |
) | |
return scale(scale.value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment