Class SlideTransition

  • All Implemented Interfaces:
    Transition

    public class SlideTransition
    extends Object
    implements Transition
    A transition that slides the incoming content horizontally over the outgoing one.

    The direction selects the edge the incoming content enters from: RIGHT_TO_LEFT (the default) enters from the right and pushes the outgoing content off to the left; LEFT_TO_RIGHT does the opposite.

    Since:
    0.2.0
    • Field Detail

      • RIGHT_TO_LEFT

        public static final int RIGHT_TO_LEFT
        Direction where the incoming content enters from the right edge and the outgoing content leaves through the left edge.
        See Also:
        Constant Field Values
      • LEFT_TO_RIGHT

        public static final int LEFT_TO_RIGHT
        Direction where the incoming content enters from the left edge and the outgoing content leaves through the right edge.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SlideTransition

        public SlideTransition()
        Creates a right-to-left slide with the default duration.
      • SlideTransition

        public SlideTransition​(int direction)
        Creates a slide in the given direction with the default duration.
        Parameters:
        direction - RIGHT_TO_LEFT or LEFT_TO_RIGHT.
      • SlideTransition

        public SlideTransition​(int direction,
                               int duration)
        Creates a slide in the given direction with the given duration.
        Parameters:
        direction - RIGHT_TO_LEFT or LEFT_TO_RIGHT.
        duration - the slide duration, in milliseconds; must be strictly positive.
        Throws:
        IllegalArgumentException - if the given duration is not strictly positive.
    • Method Detail

      • run

        public void run​(TransitionContext context,
                        TransitionListener listener)
        Description copied from interface: Transition
        Animates the page change described by the given context.

        Called on the MicroUI thread once per navigation. The implementation must call TransitionListener.onTransitionEnd() exactly once when the animation is finished.

        Specified by:
        run in interface Transition
        Parameters:
        context - the stage exposing the contents, the content area size, and the animation primitives.
        listener - the listener to notify once, when the transition finishes.