Skip to content

Instantly share code, notes, and snippets.

@itsSiddharthGupta
Created November 17, 2024 10:48
Show Gist options
  • Save itsSiddharthGupta/d934cf90ed70cbcdf20bd583b76628dd to your computer and use it in GitHub Desktop.
Save itsSiddharthGupta/d934cf90ed70cbcdf20bd583b76628dd to your computer and use it in GitHub Desktop.
Pulsating Modifier
@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