Class ContainerTransformTransition
- All Implemented Interfaces:
Animation
A transition in which one component GROWS into the whole of the next form, the way Material's container transform does: a card or a button becomes the page it opens.
The difference from MorphTransition is what is being animated.
A morph moves a component from where it is in one form to where the same component is
in the other, so it needs a counterpart on both sides and it animates a COMPONENT.
This animates a SURFACE: a rounded rectangle travels from the tapped component's
bounds out to the full form, its corners straightening as it goes, and the two
contents cross-fade inside it -- the thing that was tapped fading out while the page
fades in. Nothing needs to exist on both sides, which is the usual case: a button does
not reappear on the page it opened.
Geometry follows a fast-out-slow-in curve and the cross-fade is deliberately not symmetric: the outgoing content is gone by the time the incoming content begins, so the two are never both half visible, which reads as a dissolve rather than a transformation.
Use it where a tap on something becomes a screen:
tappedCard.setName("card");
nextForm.setTransitionInAnimator(
ContainerTransformTransition.create("card", 300));
nextForm.show();
-
Method Summary
Modifier and TypeMethodDescriptionbooleananimate()Allows the animation to reduce "repaint" calls when it returns false.voidcleanup()Optional operation to cleanup the garbage left over by a running transitioncopy(boolean reverse) Create a copy of the transition, usually the transition used is a copy.static ContainerTransformTransitionCreates a transition that grows the named component into the next form.voidCallback thats invoked before a transition begins, the source form may be null for the first form in the application.voidDraws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.Methods inherited from class Transition
cleanSource, getDestination, getSource, hideInterformContainers, init, paintInterformContainers, showInterformContainers
-
Method Details
-
create
Creates a transition that grows the named component into the next form.
Parameters
-
componentName: theComponent.setName(String)of the component in the OUTGOING form that the next form grows out of. When no component carries that name the transition still runs, growing from the centre of the screen. -
duration: the duration in milliseconds
Returns
the transition
-
-
initTransition
public void initTransition()Description copied from class:TransitionCallback 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()Description copied from class:TransitionAllows 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
Description copied from class:TransitionDraws 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
-
cleanup
public void cleanup()Description copied from class:TransitionOptional operation to cleanup the garbage left over by a running transition- Overrides:
cleanupin classTransition
-
copy
Description copied from class:TransitionCreate 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
-