Class Move
transform property.
Move builds a composite transform value from its configured parts:
translate(x, y), scale(s), and rotate(r). Only non-null
parts are included in the output. This allows precise control over each
transform function without writing raw CSS strings.
Usage:
// Slide 200px to the right
element.addTransition(new Move().setX(200));
element.transitionForward();
// Move diagonally and scale up
new Move().setX("300px").setY("150px").setScale(1.5f)
// Rotate 45 degrees
new Move().setRotation(45)
// Use in a TransitionSequence
TransitionSequence seq = new TransitionSequence(element);
seq.add(new Move().setX(200).setDuration(0.5f));
seq.add(new Move().setX(200).setY(100).setScale(1.4f).setDuration(0.4f));
seq.play();
- Since:
- 2026
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyEndState(CssStyle style) Applies the transition's end state to the given style.Returns the rotation value.getScale()Returns the scale factor.protected String[]Returns the CSS property names that this transition animates.getX()Returns the horizontal translation value.getY()Returns the vertical translation value.voidrestoreOriginalState(CssStyle style, CssStyle snapshot) Restores previously saved property values to the given style.setRotation(int degrees) Sets the rotation in degrees.setRotation(String value) Sets the rotation as a CSS angle string.setScale(float scale) Sets the scale factor.setX(int pixels) Sets the horizontal translation in pixels.Sets the horizontal translation using a CSS unit value.Sets the horizontal translation as a CSS value string.setY(int pixels) Sets the vertical translation in pixels.Sets the vertical translation using a CSS unit value.Sets the vertical translation as a CSS value string.voidsnapshotCurrentState(CssStyle current, CssStyle snapshot) Saves the current values of the transition's properties from the element's style.Methods inherited from class com.oorian.css.transitions.Transition
buildTransitionValue, buildTransitionValue, getDurationMs, getTimingFunction, setDuration, setSpeed
-
Constructor Details
-
Move
public Move()Constructs a Move transition with no transform values set.At least one transform function must be configured via setters before use.
-
-
Method Details
-
setX
Sets the horizontal translation as a CSS value string.- Parameters:
value- any valid CSS length value (e.g.,"200px","50%","10em")- Returns:
- this Move for method chaining
-
setX
Sets the horizontal translation in pixels.- Parameters:
pixels- the translation distance in pixels- Returns:
- this Move for method chaining
-
setX
Sets the horizontal translation using a CSS unit value.- Parameters:
units- the translation distance as a CSS unit (e.g.,new Px(200),new Percent(50))- Returns:
- this Move for method chaining
-
getX
Returns the horizontal translation value.- Returns:
- the CSS translation value, or
nullif not set
-
setY
Sets the vertical translation as a CSS value string.- Parameters:
value- any valid CSS length value (e.g.,"150px","25%","5em")- Returns:
- this Move for method chaining
-
setY
Sets the vertical translation in pixels.- Parameters:
pixels- the translation distance in pixels- Returns:
- this Move for method chaining
-
setY
Sets the vertical translation using a CSS unit value.- Parameters:
units- the translation distance as a CSS unit (e.g.,new Px(150),new Rem(3))- Returns:
- this Move for method chaining
-
getY
Returns the vertical translation value.- Returns:
- the CSS translation value, or
nullif not set
-
setScale
Sets the scale factor.A value of
1.0is the original size,1.5is 150%,0.5is 50%, etc.- Parameters:
scale- the scale factor- Returns:
- this Move for method chaining
-
getScale
Returns the scale factor.- Returns:
- the scale factor, or
nullif not set
-
setRotation
Sets the rotation as a CSS angle string.- Parameters:
value- any valid CSS angle value (e.g.,"45deg","0.5turn","1.57rad")- Returns:
- this Move for method chaining
-
setRotation
Sets the rotation in degrees.- Parameters:
degrees- the rotation angle in degrees- Returns:
- this Move for method chaining
-
getRotation
Returns the rotation value.- Returns:
- the CSS angle value, or
nullif not set
-
getTransitionProperties
Returns the CSS property names that this transition animates.Subclasses return the CSS properties they modify (e.g.,
"opacity","transform","max-height"). These are used to build the CSStransitionshorthand.- Specified by:
getTransitionPropertiesin classTransition- Returns:
- an array of CSS property names
-
applyEndState
Applies the transition's end state to the given style.This method sets the CSS property values that represent the final state of the transition. For example, a fade-out sets
opacity: 0.- Specified by:
applyEndStatein classTransition- Parameters:
style- the CssStyle to apply end-state values to
-
snapshotCurrentState
Saves the current values of the transition's properties from the element's style.Before a transition plays forward, the current property values are saved so they can be restored when playing in reverse. If a property has no current value, the subclass should save a sensible default (e.g.,
"1"for opacity).- Specified by:
snapshotCurrentStatein classTransition- Parameters:
current- the element's current CssStyle to read values fromsnapshot- the CssStyle to save values into
-
restoreOriginalState
Restores previously saved property values to the given style.This method copies values from the snapshot back to the element's style, causing the browser to animate back to the original state.
- Specified by:
restoreOriginalStatein classTransition- Parameters:
style- the CssStyle to restore values tosnapshot- the CssStyle containing previously saved values
-