I've got the following: ``` val rotation by ani...
# compose
c
I've got the following:
Copy code
val rotation by animateFloatAsState(
        targetValue = if (state) 360.0f else 0f, 
        animationSpec = if (state) InfiniteRepeatableSpec(tween(durationMillis = 500, easing = LinearEasing)) else snap())
Which I use to rotate an image of a fan when the fan is on, and when it is off, it rotates to a final stationary position. However if the composable first appears in an on state, the animation will not start. How should I handle this?
j
It could animate in composition state, and it's not visible, you can delay animation in Millis to see animation in action.
c
But it's
InfiniteRepeatableSpec
so I would imagine if it was supposed to be animating, it would animate indefinitely? I'll see if I can't get something working with a delay though, cheers