public static void setDirection(EventHandler<ActionEvent> handler, MovingType direction) {
        if (handler != null && StepDirection.class.isInstance(handler)) {
            ((StepDirection) handler).setDirection(direction);
        }
        if (handler != null && TransitionControl.AnimationEndHandler.class.isInstance(handler)) {
            setDirection(((TransitionControl.AnimationEndHandler)handler).oldEventHandler,direction);
        }
    }