Class MorphTransition.MorphElement
java.lang.Object
com.codename1.ui.animations.MorphTransition.MorphElement
- Enclosing class:
MorphTransition
Describes an arbitrary rendered element that the morph tweens between two
states: position, size, opacity, rotation and scale. Build one with
#create(Image) (e.g. a rendered SVG, an icon, an EncodedImage) or
#create(Component) (the component is snapshotted to an image when the
transition initializes), then hand it to
MorphTransition#morph(MorphElement).
All builder setters return this for chaining; every state has an
identity default (opacity 1, rotation 0, scale 1, and the element's
own bounds for position / size) so only the properties you actually want
to tween need to be set.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MorphTransition.MorphElementCreates an element backed by aComponent; the component is snapshotted to an image when the transition initializes.static MorphTransition.MorphElementCreates an element backed by a pre-renderedImage(a rasterized SVG, an icon, a snapshot, ...).from(int x, int y, int w, int h) Sets the source rectangle (state att = 0).floatThe interpolated height of the element at the current progress.floatThe interpolated opacity (0..1) at the current progress.floatThe interpolated rotation (degrees) at the current progress.floatThe interpolated scale multiplier at the current progress.floatThe interpolated width of the element at the current progress.floatThe interpolated x of the element at the current progress.floatThe interpolated y of the element at the current progress.opacity(float from, float to) Tweens the element opacity fromfromtoto(both[0, 1]).rotation(float fromDegrees, float toDegrees) Tweens the element rotation in degrees about its center.scale(float from, float to) Tweens an extra scale multiplier about the element center (on top of the interpolated size).to(int x, int y, int w, int h) Sets the destination rectangle (state att = 1).
-
Method Details
-
create
Creates an element backed by a pre-renderedImage(a rasterized SVG, an icon, a snapshot, ...). -
create
Creates an element backed by aComponent; the component is snapshotted to an image when the transition initializes. The component's laid-out bounds seed the source rectangle unless#from(int, int, int, int)is given. -
from
Sets the source rectangle (state att = 0). -
to
Sets the destination rectangle (state att = 1). -
opacity
Tweens the element opacity fromfromtoto(both[0, 1]). -
rotation
Tweens the element rotation in degrees about its center. -
scale
Tweens an extra scale multiplier about the element center (on top of the interpolated size). -
getCurrentX
public float getCurrentX()The interpolated x of the element at the current progress. -
getCurrentY
public float getCurrentY()The interpolated y of the element at the current progress. -
getCurrentWidth
public float getCurrentWidth()The interpolated width of the element at the current progress. -
getCurrentHeight
public float getCurrentHeight()The interpolated height of the element at the current progress. -
getCurrentOpacity
public float getCurrentOpacity()The interpolated opacity (0..1) at the current progress. -
getCurrentRotation
public float getCurrentRotation()The interpolated rotation (degrees) at the current progress. -
getCurrentScale
public float getCurrentScale()The interpolated scale multiplier at the current progress.
-