Tash
02/17/2021, 9:18 PMAnimatedFloatModel
s together and then listen for the end of the collective animation?
@Stable
class FooDragState {
val animatedOffsetX = AnimatedFloatModel(initialValue = 0f, clock)
val animatedOffsetY = AnimatedFloatModel(initialValue = 0f, clock)
(animatedOffsetX, animatedOffsetY).animateTo(1f, animationSpec, onEnd = { /** do something **/ })
}
Animatable
as of alpha12
. Looks like the animateTo(...)
functions are now suspend
functions. Perhaps animating two Animatable
s together would look like launching two animateTo()
s and then awaiting the completion of both jobs.Doris Liu
02/17/2021, 10:31 PMPerhaps animating twoYes. That is correct. If yous together would look like launching twoAnimatable
s and then awaiting the completion of both jobs.animateTo()
launch
them from the same coroutineScope { ... }
, you can just wait for the coroutineScope to finish. 🙂Tash
02/17/2021, 10:34 PM