Class CupertinoPageTransition

java.lang.Object
com.codename1.ui.animations.Transition
com.codename1.ui.animations.CupertinoPageTransition
All Implemented Interfaces:
Animation

public final class CupertinoPageTransition extends Transition

The iOS page push: two pages moving at different speeds, over different distances.

A plain slide holds the two pages a fixed screen apart and moves the pair, which makes them one rigid object. This transition is the reason iOS depth reads the way it does: the arriving page crosses the WHOLE screen while the page it covers drifts only a THIRD of it, and each rides its own curve. The gap between them closes as they travel, which is what says one is in front of the other.

Sliding both the full distance is not a subtle difference. A third of the way through a push the strip of the old page still showing is not dimmer or shifted -- it is a different PART of that page: measured against the reference at 150ms of a 500ms push on a 1125px screen, the old page belongs 270px to the left and ours had it 855px to the left, so the visible strip showed its far edge where the reference shows its middle.

  • Method Details

    • create

      public static CupertinoPageTransition create(int duration)

      Creates the transition.

      Parameters
      • duration: the push duration in milliseconds
      Returns

      the transition

    • getDuration

      public int getDuration()

      The push duration in milliseconds.

      Returns

      the duration this transition was created with

    • isBack

      public boolean isBack()

      Whether this instance plays the way BACK, with the roles of the two pages swapped.

      Returns

      true if this is the pop half of the transition

    • initTransition

      public void initTransition()
      Description copied from class: Transition
      Callback thats invoked before a transition begins, the source form may be null for the first form in the application.
      Overrides:
      initTransition in class Transition
    • animate

      public boolean animate()
      Description copied from class: Transition

      Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the com.codename1.ui.Display class.

      Returns

      true if a repaint is desired or false if no repaint is necessary

      Specified by:
      animate in interface Animation
      Specified by:
      animate in class Transition
    • paint

      public void paint(Graphics g)
      Description copied from class: Transition

      Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.

      Parameters
      • g: graphics context
      Specified by:
      paint in interface Animation
      Specified by:
      paint in class Transition
    • cleanup

      public void cleanup()
      Description copied from class: Transition
      Optional operation to cleanup the garbage left over by a running transition
      Overrides:
      cleanup in class Transition
    • copy

      public Transition copy(boolean reverse)
      Description copied from class: Transition

      Create a copy of the transition, usually the transition used is a copy.

      Parameters
      • reverse: @param reverse creates a new transition instance with "reverse" behavior useful for signifying "back" operations
      Returns

      new transition instance

      Overrides:
      copy in class Transition