Nathan Castlehow
06/29/2021, 9:06 AMNathan Castlehow
06/29/2021, 9:06 AMvar targetValue by remember { mutableStateOf(0) }
val value by animateIntAsState(
targetValue = targetValue,
animationSpec = infiniteRepeatable(
animation = tween(durationMillis = (targetValue * 5000), easing = LinearEasing),
repeatMode = RepeatMode.Restart
)
)
LaunchedEffect(Unit){
targetValue = descriptions.size
}
Nathan Castlehow
06/29/2021, 9:07 AMval value by animateIntAsState(
targetValue = 10,
animationSpec = infiniteRepeatable(
animation = tween(durationMillis = (10 * 5000), easing = LinearEasing),
repeatMode = RepeatMode.Restart
)
)
Nathan Castlehow
06/29/2021, 9:07 AMAlbert Chang
06/29/2021, 9:51 AMvalue
be? The doc explains it well. Basically use animate*AsState
when the animation is state-based, which doesn't look like your case.Nathan Castlehow
06/29/2021, 9:55 AMAlbert Chang
06/29/2021, 10:00 AManimate*AsState
doesn't allow you to specify initial value because it's purely state-based and the initial value is just the value of the first state. The example shows the usage of it.Albert Chang
06/29/2021, 10:01 AMNathan Castlehow
06/30/2021, 1:03 AM