public final class ContainerTransformTransition
- Object
- Transition
- ContainerTransformTransition
ImplementsAnimation
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();
Methods
public static ContainerTransformTransition create(String componentName, int duration) | Creates a transition that grows the named component into the next form. |
public void initTransition() | Callback thats invoked before a transition begins, the source form may be null for the first form in the application. |
public boolean animate() | Allows the animation to reduce “repaint” calls when it returns false. |
public void paint(Graphics g) | Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature. |
public void cleanup() | Optional operation to cleanup the garbage left over by a running transition |
public Transition copy(boolean reverse) | Create a copy of the transition, usually the transition used is a copy. |
Inherited methods
Method details
create
public static ContainerTransformTransition create(String componentName, int duration)Parameters
componentNameString- the
Component.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. durationint- the duration in milliseconds
Returns
initTransition
public void initTransition()animate
public boolean animate()com.codename1.ui.Display class.Returns
paint
public void paint(Graphics g)Parameters
gGraphics- graphics context
cleanup
public void cleanup()copy
public Transition copy(boolean reverse)Parameters
reverseboolean- creates a new transition instance with “reverse” behavior useful for signifying “back” operations