Skip to content

Instantly share code, notes, and snippets.

@maiatoday
Created May 26, 2022 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maiatoday/d9abcba794b629339f46bfbf5ff75baf to your computer and use it in GitHub Desktop.
Save maiatoday/d9abcba794b629339f46bfbf5ff75baf to your computer and use it in GitHub Desktop.
HeartPulse
@Composable
fun HeartPulse(modifier: Modifier = Modifier) {
val infiniteTransition = rememberInfiniteTransition()
val heartSize by infiniteTransition.animateFloat(
initialValue = 0.5f,
targetValue = 1.5f,
animationSpec = infiniteRepeatable(
animation = tween(1000, easing = FastOutSlowInEasing),
repeatMode = RepeatMode.Reverse
)
)
val heartColor by infiniteTransition.animateColor(
initialValue = Color.Magenta,
targetValue = Color.Red,
animationSpec = infiniteRepeatable(
animation = tween(1000, easing = FastOutSlowInEasing),
repeatMode = RepeatMode.Reverse
)
)
Heart(modifier.scale(heartSize), heartColor)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment