Class MorphTransition
- All Implemented Interfaces:
Animation
-
Method Summary
Modifier and TypeMethodDescriptionbooleananimate()Allows the animation to reduce "repaint" calls when it returns false.copy(boolean reverse) Create a copy of the transition, usually the transition used is a copy.static MorphTransitioncreate(int duration) Creates a transition with the given duration, this transition should be modified with the builder methods such as morphvoidCallback thats invoked before a transition begins, the source form may be null for the first form in the application.booleanReturns the current snapshot-mode setting.Morphs the component with the given source name in the source container hierarchy to the component with the same name in the destination hierarchyMorphs the component with the given source name in the source container hierarchy to the component with the given name in the destination hierarchyvoidDraws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.snapshotMode(boolean enabled) Enables the image-snapshot path.Methods inherited from class Transition
cleanSource, cleanup, getDestination, getSource, hideInterformContainers, init, paintInterformContainers, showInterformContainers
-
Method Details
-
snapshotMode
Enables the image-snapshot path. Each
(source, dest)pair is rendered once into anImageatinitTransition()(clipped to the component's own bounds; off-viewport children do not contribute pixels), then the tween draws those images at the interpolated(x, y, w, h).Use this when:
- The source lives inside a scrolling container whose
scrollX/scrollYwould otherwise leak off-viewport child pixels into the morph (the cross-form morph clipping artifact). - The source has children with dynamic content (a
BrowserComponent, a video frame, a custom-painted background) that should be frozen visually for the duration of the animation. - The source's parent applies a clip that the layered pane wouldn't replicate.
Default is off to preserve back-compat with the legacy live-paint path. Always pair with a screenshot regression test (see
scripts/hellocodenameone/.../MorphTransitionTest).Parameters
enabled:trueto snapshot,falsefor the legacy live-paint mode
Returns
this transition (for chaining with
#morph(String)etc.) - The source lives inside a scrolling container whose
-
isSnapshotMode
public boolean isSnapshotMode()Returns the current snapshot-mode setting. See#snapshotMode(boolean). -
create
Creates a transition with the given duration, this transition should be modified with the builder methods such as morph
Parameters
duration: the duration of the transition
Returns
a new Morph transition instance
-
copy
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:
copyin classTransition
-
morph
Morphs the component with the given source name in the source container hierarchy to the component with the same name in the destination hierarchy
Parameters
cmp: the compoennt name
Returns
this so morph operations can be chained as MorphTransition t = MorphTransition.create(300).morph("a").("c");
-
morph
Morphs the component with the given source name in the source container hierarchy to the component with the given name in the destination hierarchy
Parameters
-
source -
to
Returns
this so morph operations can be chained as MorphTransition t = MorphTransition.create(300).morph("a", "b").("c", "d");
-
-
initTransition
public void initTransition()Callback thats invoked before a transition begins, the source form may be null for the first form in the application.- Overrides:
initTransitionin classTransition
-
animate
public boolean animate()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.Displayclass.Returns
true if a repaint is desired or false if no repaint is necessary
- Specified by:
animatein interfaceAnimation- Specified by:
animatein classTransition
-
paint
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:
paintin interfaceAnimation- Specified by:
paintin classTransition
-