Jakub Ledwon
03/16/2021, 10:11 PMfontSize
(pulse effect animation). I want an animation to be infinite, but I want to be able to restart an animation from default value when state changes. So basically I have a switch which determines which text should be animating, and when switch changes the animation should reset. As my animation is infinite I tried rememberInfiniteTransition
, but there is no way to restart it (or I didn't find any). What would be the best approach for this problem? I would need something like InfiniteTransition
but I don't want to remember it during state changes.Doris Liu
03/16/2021, 10:28 PMval infiniteTransition = rememberInfiniteTransition()
val fontSize by key(myState) {
infiniteTransition.animateFloat(0f, 1f, infiniteRepeatable(
tween(1000)
))
}
When myState
changes, the animation will be restarted