val animColor = animatedColor(initVal = Color.Red) onActive { animScale.animateTo( targetValue = 1.3f, anim = repeatable( iterations = AnimationConstants.Infinite, animation = tween(durationMillis = 300, easing = FastOutLinearInEasing, delayMillis = 1000) ) ) animColor.animateTo( targetValue = Color.Blue, anim = repeatable( iterations = AnimationConstants.Infinite, animation = tween(durationMillis = 300, easing = LinearEasing, delayMillis = 1000) ) ) } Image(asset = Icons.Default.Favorite, modifier = Modifier.padding(10.dp).size((40*animScale.value).dp), colorFilter = ColorFilter.tint(animColor.value) ) } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 val animScale = animatedFloat(initVal = 1f) val animColor = animatedColor(initVal = Color.Red) @Composable 1 fun HeartBeatDemo() { 2 3 4 5 onActive { 6 animScale.animateTo( 7 targetValue = 1.3f, 8 anim = repeatable( 9 iterations = AnimationConstants.Infinite, 10 animation = tween(durationMillis = 300, 11 easing = FastOutLinearInEasing, delayMillis = 1000) 12 ) 13 ) 14 15 animColor.animateTo( 16 targetValue = Color.Blue, 17 anim = repeatable( 18 iterations = AnimationConstants.Infinite, 19 animation = tween(durationMillis = 300, 20 easing = LinearEasing, delayMillis = 1000) 21 ) 22 ) 23 } 24 25 Image(asset = Icons.Default.Favorite, 26 modifier = Modifier.padding(10.dp).size((40*animScale.value).dp), 27 colorFilter = ColorFilter.tint(animColor.value) 28 ) 29 } 30 animScale.animateTo( targetValue = 1.3f, anim = repeatable( iterations = AnimationConstants.Infinite, animation = tween(durationMillis = 300, easing = FastOutLinearInEasing, delayMillis = 1000) ) ) @Composable 1 fun HeartBeatDemo() { 2 val animScale = animatedFloat(initVal = 1f) 3 val animColor = animatedColor(initVal = Color.Red) 4 5 onActive { 6 7 8 9 10 11 12 13 14 15 animColor.animateTo( 16 targetValue = Color.Blue, 17 anim = repeatable( 18 iterations = AnimationConstants.Infinite, 19 animation = tween(durationMillis = 300, 20 easing = LinearEasing, delayMillis = 1000) 21 ) 22 ) 23 } 24 25 Image(asset = Icons.Default.Favorite, 26 modifier = Modifier.padding(10.dp).size((40*animScale.value).dp), 27 colorFilter = ColorFilter.tint(animColor.value) 28 ) 29 } 30 modifier = Modifier.padding(10.dp).size((40*animScale.value).dp), colorFilter = ColorFilter.tint(animColor.value) @Composable 1 fun HeartBeatDemo() { 2 val animScale = animatedFloat(initVal = 1f) 3 val animColor = animatedColor(initVal = Color.Red) 4 5 onActive { 6 animScale.animateTo( 7 targetValue = 1.3f, 8 anim = repeatable( 9 iterations = AnimationConstants.Infinite, 10 animation = tween(durationMillis = 300, 11 easing = FastOutLinearInEasing, delayMillis = 1000) 12 ) 13 ) 14 15 animColor.animateTo( 16 targetValue = Color.Blue, 17 anim = repeatable( 18 iterations = AnimationConstants.Infinite, 19 animation = tween(durationMillis = 300, 20 easing = LinearEasing, delayMillis = 1000) 21 ) 22 ) 23 } 24 25 Image(asset = Icons.Default.Favorite, 26 27 28 ) 29 } 30 @Composable fun HeartBeatDemo() { val animScale = animatedFloat(initVal = 1f) val animColor = animatedColor(initVal = Color.Red) onActive { animScale.animateTo( targetValue = 1.3f, anim = repeatable( iterations = AnimationConstants.Infinite, animation = tween(durationMillis = 300, easing = FastOutLinearInEasing, delayMillis = 1000) ) ) animColor.animateTo( targetValue = Color.Blue, anim = repeatable( iterations = AnimationConstants.Infinite, animation = tween(durationMillis = 300, easing = LinearEasing, delayMillis = 1000) ) ) } Image(asset = Icons.Default.Favorite, modifier = Modifier.padding(10.dp).size((40*animScale.value).dp), colorFilter = ColorFilter.tint(animColor.value) ) } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Repeated Animations with AnimatedValue 17