Adding callbacks to the animation state machine