public final class CommonTransitions extends Transition
Contains common transition animations that can be applied to forms & components including the following types:
The code below demonstrates the common transitions
Modifier and Type | Field and Description |
---|---|
static int |
SLIDE_HORIZONTAL
Slide the transition horizontally
|
static int |
SLIDE_VERTICAL
Slide the transition vertically
|
Modifier and Type | Method and Description |
---|---|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false.
|
void |
cleanup()
Optional operation to cleanup the garbage left over by a running transition
|
Transition |
copy(boolean reverse)
Create a copy of the transition, usually the transition used is a copy.
|
static CommonTransitions |
createCover(int type,
boolean forward,
int duration)
Creates a cover transition with the given duration and direction
|
static CommonTransitions |
createDialogPulsate()
Creates a dialog pulsate transition
|
static CommonTransitions |
createEmpty()
Creates an empty transition that does nothing.
|
static CommonTransitions |
createFade(int duration)
Creates a transition for fading a form in while fading out the original form
|
static CommonTransitions |
createFastSlide(int type,
boolean forward,
int duration)
Deprecated.
this is not faster than slide on modern devices, you should use that
createSlide(int, boolean, int) |
static CommonTransitions |
createFastSlide(int type,
boolean forward,
int duration,
boolean drawDialogMenu)
Deprecated.
this is not faster than slide on modern devices, you should use that
createSlide(int, boolean, int, boolean) |
protected Motion |
createMotion(int startOffset,
int dest,
int speed)
This method can be overriden by subclasses to create their own motion object on the fly
|
static CommonTransitions |
createSlide(int type,
boolean forward,
int duration)
Creates a slide transition with the given duration and direction
|
static CommonTransitions |
createSlide(int type,
boolean forward,
int duration,
boolean drawDialogMenu)
Creates a slide transition with the given duration and direction
|
static CommonTransitions |
createSlideFadeTitle(boolean forward,
int duration)
Creates a slide transition for the body of the form that fades the title in while sliding
|
static CommonTransitions |
createTimeline(Image animation)
Creates a transition using an animated image object (e.g.
|
static CommonTransitions |
createUncover(int type,
boolean forward,
int duration)
Creates a uncover transition with the given duration and direction
|
Motion |
getMotion()
Motion represents the physical movement within a transition, it can
be replaced by the user to provide a more appropriate physical feel
|
int |
getTransitionSpeed()
Returns the speed of the transition in milliseconds
|
void |
initTransition()
Callback thats invoked before a transition begins, the source form may be null
for the first form in the application.
|
static boolean |
isDefaultLinearMotion()
Indicates whether the motion associated with these transitions by default is linear or spline motion
|
boolean |
isForwardSlide()
Indicates the slide/cover transition direction
|
boolean |
isHorizontalCover()
Returns true if this is a horizontal cover transition
|
boolean |
isHorizontalSlide()
Returns true if this is a horizontal slide transition
|
boolean |
isLinearMotion()
Indicates whether the motion associated with this transition is linear or spline motion
|
boolean |
isVerticalCover()
Returns true if this is a vertical cover transition
|
boolean |
isVerticalSlide()
Returns true if this is a vertical slide transition
|
void |
paint(Graphics g)
Draws the animation, within a component the standard paint method would be
invoked since it bares the exact same signature.
|
static void |
setDefaultLinearMotion(boolean aDefaultLinearMotion)
Indicates whether the motion associated with these transitions by default is linear or spline motion
|
void |
setLinearMotion(boolean linearMotion)
Indicates whether the motion associated with this transition is linear or spline motion
|
void |
setMotion(LazyValue<Motion> motion)
Motion represents the physical movement within a transition, it can
be replaced by the user to provide a more appropriate physical feel
|
void |
setMotion(Motion motion)
Motion represents the physical movement within a transition, it can
be replaced by the user to provide a more appropriate physical feel
|
cleanSource, getDestination, getSource, hideInterformContainers, init, paintInterformContainers, showInterformContainers
public static final int SLIDE_HORIZONTAL
public static final int SLIDE_VERTICAL
public boolean isHorizontalSlide()
public boolean isVerticalSlide()
public boolean isHorizontalCover()
public boolean isVerticalCover()
public boolean isForwardSlide()
public int getTransitionSpeed()
public static CommonTransitions createEmpty()
public static CommonTransitions createSlideFadeTitle(boolean forward, int duration)
forward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createDialogPulsate()
public static CommonTransitions createFastSlide(int type, boolean forward, int duration)
createSlide(int, boolean, int)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createSlide(int type, boolean forward, int duration)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createSlide(int type, boolean forward, int duration, boolean drawDialogMenu)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in milliseconddrawDialogMenu
- indicates that the menu (softkey area) of the dialog
should be kept during a slide transition. This is only relevant for
dialog in/out transitions.public static CommonTransitions createCover(int type, boolean forward, int duration)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createUncover(int type, boolean forward, int duration)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createFastSlide(int type, boolean forward, int duration, boolean drawDialogMenu)
createSlide(int, boolean, int, boolean)
type
- type can be either vertically or horizontally, which means
the movement direction of the transitionforward
- forward is a boolean value, represent the directions of
switching forms, for example for a horizontally type, true means
horizontally movement to right.duration
- represent the time the transition should take in milliseconddrawDialogMenu
- indicates that the menu (softkey area) of the dialog
should be kept during a slide transition. This is only relevant for
dialog in/out transitions.public static CommonTransitions createFade(int duration)
duration
- represent the time the transition should take in millisecondpublic static CommonTransitions createTimeline(Image animation)
animation
- the image object to executepublic void initTransition()
initTransition
in class Transition
protected Motion createMotion(int startOffset, int dest, int speed)
startOffset
- the start offset for the menudest
- the destination of the motionspeed
- the speed of the motionpublic boolean animate()
Display
class.animate
in interface Animation
animate
in class Transition
public void paint(Graphics g)
paint
in interface Animation
paint
in class Transition
g
- graphics contextpublic void cleanup()
cleanup
in class Transition
public Motion getMotion()
public void setMotion(Motion motion)
motion
- new instance of the motion class that will be used by the transitionpublic void setMotion(LazyValue<Motion> motion)
motion
- new instance of the motion class that will be used by the transitionpublic Transition copy(boolean reverse)
copy
in class Transition
reverse
- creates a new transition instance with "reverse" behavior useful
for signifying "back" operationspublic boolean isLinearMotion()
public void setLinearMotion(boolean linearMotion)
linearMotion
- the linearMotion to setpublic static boolean isDefaultLinearMotion()
public static void setDefaultLinearMotion(boolean aDefaultLinearMotion)
aDefaultLinearMotion
- the defaultLinearMotion to set