That's a topic that it's missing from most posts describing state machines: how to animate transitions.
One option is that the animated transitions themselves are states themselves.
(stateGoingFromAtoB, stateGoingFromBtoA).
But I think there must be a more clever way to do that, because doing the above the states can grow exponentially.
Two references: