hey Luka, I’ve done exactly this using
updateTransition()
and an enum to represent the animation state
in your situation you could do
enum class MyAnimState {
Initial,
ScaledUp,
ScaledDown,
Finished;
fun next() = when (this) {
Initial -> ScaledUp
ScaledUp -> ScaledDown
ScaledDown -> Finished
Finished -> Initial
}
}
using this and a when statement for each of your animatable values you can define values for each state, and by having something like:
if (transition.targetState == transition.currentState) {
myAnimState = myAnimState.next()
}
you can automatically progress to the “next” state once each one has finished