Created
May 26, 2022 18:51
-
-
Save maiatoday/d9abcba794b629339f46bfbf5ff75baf to your computer and use it in GitHub Desktop.
HeartPulse
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 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