How to perform state change that changes animation gracefully?
I have on object that I want to have different states, being:
@1: off, invisible, no animation - would prefer to set invisible for performance reasons but might have to set opacity 0 instead. -> when x = false
2: animation 1, (opacity animation - infinite loop) ----> when x = true && y > 0.5
3: animation 2, (opacity animation - infinite loop) ----> when x = true && 0.1 <y <= 0.5
4: fullbright, opacity = 1 ----> when x = true && y <= 0.1@
The problem i have is that i do not know how to get the state to only perform its property changes when the animation has finished playing.
I set the "always play to end" property of the animations to true so that they always will end "gracefully".
The problem is, i only want the state to start the other changes when the animation has fully stopped (which can be found via the "onStopped" event).
It's almost like i want the state change or transition to stop halfway through and wait for that event or something but i don't know how to do that - i suppose you could poll but that is really really bad!
If i haven't made any sense then i can try and explain a bit better...