Class RotateTransition
public final class RotateTransition
extends Transition Transition creates a rotation animation that spans its duration. This is done by updating the rotate variable of the node at regular interval. The angle value is specified in degrees. It starts from the fromAngle if provided else uses the node's rotate value.
It stops at the toAngle value if provided else it will use start value plus byAngle.
The toAngle takes precedence if both toAngle and byAngle are specified.
Code Segment Example:
import javafx.scene.shape.*;
import javafx.animation.*;
...
Rectangle rect = new Rectangle (100, 40, 100, 100);
rect.setArcHeight(50);
rect.setArcWidth(50);
rect.setFill(Color.VIOLET);
RotateTransition rt = new RotateTransition(Duration.millis(3000), rect);
rt.setByAngle(180);
rt.setCycleCount(4);
rt.setAutoReverse(true);
rt.play();
...
- Since:
- JavaFX 2.0
- See Also:
-
Transition,Animation
Property Summary
| Type | Property | Description |
|---|---|---|
ObjectProperty<Point3D> | axis | Specifies the axis of rotation for this RotateTransition. |
DoubleProperty | byAngle | Specifies the incremented stop angle value, from the start, of this RotateTransition. |
ObjectProperty<Duration> | duration | The duration of this RotateTransition. |
DoubleProperty | fromAngle | Specifies the start angle value for this RotateTransition. |
ObjectProperty<Node> | node | The target node of this RotateTransition. |
DoubleProperty | toAngle | Specifies the stop angle value for this RotateTransition. |
Properties declared in class javafx.animation.Transition
interpolator
Properties declared in class javafx.animation.Animation
autoReverse, currentRate, currentTime, cycleCount, cycleDuration, delay, onFinished, rate, status, totalDuration
Nested Class Summary
Nested classes/interfaces declared in class javafx.animation.Animation
Animation.Status
Field Summary
Fields declared in class javafx.animation.Animation
INDEFINITE
Constructor Summary
| Constructor | Description |
|---|---|
RotateTransition() | The constructor of RotateTransition
|
RotateTransition(Duration duration) | The constructor of RotateTransition
|
RotateTransition(Duration duration,
Node node) | The constructor of RotateTransition
|
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
ObjectProperty<Point3D> | axisProperty() | Specifies the axis of rotation for this RotateTransition. |
DoubleProperty | byAngleProperty() | Specifies the incremented stop angle value, from the start, of this RotateTransition. |
ObjectProperty<Duration> | durationProperty() | The duration of this RotateTransition. |
DoubleProperty | fromAngleProperty() | Specifies the start angle value for this RotateTransition. |
Point3D | getAxis() | Gets the value of the property axis. |
double | getByAngle() | Gets the value of the property byAngle. |
Duration | getDuration() | Gets the value of the property duration. |
double | getFromAngle() | Gets the value of the property fromAngle. |
Node | getNode() | Gets the value of the property node. |
double | getToAngle() | Gets the value of the property toAngle. |
ObjectProperty<Node> | nodeProperty() | The target node of this RotateTransition. |
void | setAxis(Point3D value) | Sets the value of the property axis. |
void | setByAngle(double value) | Sets the value of the property byAngle. |
void | setDuration(Duration value) | Sets the value of the property duration. |
void | setFromAngle(double value) | Sets the value of the property fromAngle. |
void | setNode(Node value) | Sets the value of the property node. |
void | setToAngle(double value) | Sets the value of the property toAngle. |
DoubleProperty | toAngleProperty() | Specifies the stop angle value for this RotateTransition. |
Methods declared in class javafx.animation.Transition
getCachedInterpolator, getInterpolator, getParentTargetNode, interpolate, interpolatorProperty, setInterpolator
Methods declared in class javafx.animation.Animation
autoReverseProperty, currentRateProperty, currentTimeProperty, cycleCountProperty, cycleDurationProperty, delayProperty, getCuePoints, getCurrentRate, getCurrentTime, getCycleCount, getCycleDuration, getDelay, getOnFinished, getRate, getStatus, getTargetFramerate, getTotalDuration, isAutoReverse, jumpTo, jumpTo, onFinishedProperty, pause, play, playFrom, playFrom, playFromStart, rateProperty, setAutoReverse, setCycleCount, setCycleDuration, setDelay, setOnFinished, setRate, setStatus, statusProperty, stop, totalDurationProperty
Property Details
node
public final ObjectProperty<Node> nodeProperty
RotateTransition. It is not possible to change the target node of a running RotateTransition. If the value of node is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- See Also:
-
getNode(),setNode(Node)
duration
public final ObjectProperty<Duration> durationProperty
RotateTransition. It is not possible to change the duration of a running RotateTransition. If the value of duration is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
Note: While the unit of duration is a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower than Duration.ZERO will result in IllegalArgumentException.
- Default value:
- 400ms
- See Also:
-
getDuration(),setDuration(Duration)
axis
public final ObjectProperty<Point3D> axisProperty
RotateTransition. Use node.rotationAxis for axis of rotation if this axis is null. It is not possible to change the axis of a running RotateTransition. If the value of axis is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- Default value:
- null
- See Also:
-
getAxis(),setAxis(Point3D)
fromAngle
public final DoubleProperty fromAngleProperty
RotateTransition. It is not possible to change fromAngle of a running RotateTransition. If the value of fromAngle is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- Default value:
Double.NaN- See Also:
-
getFromAngle(),setFromAngle(double)
toAngle
public final DoubleProperty toAngleProperty
RotateTransition. It is not possible to change toAngle of a running RotateTransition. If the value of toAngle is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- Default value:
Double.NaN- See Also:
-
getToAngle(),setToAngle(double)
byAngle
public final DoubleProperty byAngleProperty
RotateTransition. It is not possible to change byAngle of a running RotateTransition. If the value of byAngle is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- See Also:
-
getByAngle(),setByAngle(double)
Constructor Details
RotateTransition
public RotateTransition(Duration duration, Node node)
RotateTransition
- Parameters:
-
duration- The duration of theRotateTransition -
node- Thenodewhich will be rotated
RotateTransition
public RotateTransition(Duration duration)
RotateTransition
- Parameters:
-
duration- The duration of theRotateTransition
RotateTransition
public RotateTransition()
RotateTransition
Method Details
setNode
public final void setNode(Node value)
- Property description:
- The target node of this
RotateTransition.It is not possible to change the target
nodeof a runningRotateTransition. If the value ofnodeis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value.
getNode
public final Node getNode()
- Property description:
- The target node of this
RotateTransition.It is not possible to change the target
nodeof a runningRotateTransition. If the value ofnodeis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value.
nodeProperty
public final ObjectProperty<Node> nodeProperty()
RotateTransition. It is not possible to change the target node of a running RotateTransition. If the value of node is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- See Also:
-
getNode(),setNode(Node)
setDuration
public final void setDuration(Duration value)
- Property description:
- The duration of this
RotateTransition.It is not possible to change the
durationof a runningRotateTransition. If the value ofdurationis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value.Note: While the unit of
durationis a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower thanDuration.ZEROwill result inIllegalArgumentException. - Default value:
- 400ms
getDuration
public final Duration getDuration()
- Property description:
- The duration of this
RotateTransition.It is not possible to change the
durationof a runningRotateTransition. If the value ofdurationis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value.Note: While the unit of
durationis a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower thanDuration.ZEROwill result inIllegalArgumentException. - Default value:
- 400ms
durationProperty
public final ObjectProperty<Duration> durationProperty()
RotateTransition. It is not possible to change the duration of a running RotateTransition. If the value of duration is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
Note: While the unit of duration is a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower than Duration.ZERO will result in IllegalArgumentException.
- Default value:
- 400ms
- See Also:
-
getDuration(),setDuration(Duration)
setAxis
public final void setAxis(Point3D value)
- Property description:
- Specifies the axis of rotation for this
RotateTransition. Usenode.rotationAxisfor axis of rotation if thisaxisis null.It is not possible to change the
axisof a runningRotateTransition. If the value ofaxisis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value. - Default value:
- null
getAxis
public final Point3D getAxis()
- Property description:
- Specifies the axis of rotation for this
RotateTransition. Usenode.rotationAxisfor axis of rotation if thisaxisis null.It is not possible to change the
axisof a runningRotateTransition. If the value ofaxisis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value. - Default value:
- null
axisProperty
public final ObjectProperty<Point3D> axisProperty()
RotateTransition. Use node.rotationAxis for axis of rotation if this axis is null. It is not possible to change the axis of a running RotateTransition. If the value of axis is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- Default value:
- null
- See Also:
-
getAxis(),setAxis(Point3D)
setFromAngle
public final void setFromAngle(double value)
- Property description:
- Specifies the start angle value for this
RotateTransition.It is not possible to change
fromAngleof a runningRotateTransition. If the value offromAngleis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
getFromAngle
public final double getFromAngle()
- Property description:
- Specifies the start angle value for this
RotateTransition.It is not possible to change
fromAngleof a runningRotateTransition. If the value offromAngleis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
fromAngleProperty
public final DoubleProperty fromAngleProperty()
RotateTransition. It is not possible to change fromAngle of a running RotateTransition. If the value of fromAngle is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- Default value:
Double.NaN- See Also:
-
getFromAngle(),setFromAngle(double)
setToAngle
public final void setToAngle(double value)
- Property description:
- Specifies the stop angle value for this
RotateTransition.It is not possible to change
toAngleof a runningRotateTransition. If the value oftoAngleis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
getToAngle
public final double getToAngle()
- Property description:
- Specifies the stop angle value for this
RotateTransition.It is not possible to change
toAngleof a runningRotateTransition. If the value oftoAngleis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
toAngleProperty
public final DoubleProperty toAngleProperty()
RotateTransition. It is not possible to change toAngle of a running RotateTransition. If the value of toAngle is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- Default value:
Double.NaN- See Also:
-
getToAngle(),setToAngle(double)
setByAngle
public final void setByAngle(double value)
- Property description:
- Specifies the incremented stop angle value, from the start, of this
RotateTransition.It is not possible to change
byAngleof a runningRotateTransition. If the value ofbyAngleis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value.
getByAngle
public final double getByAngle()
- Property description:
- Specifies the incremented stop angle value, from the start, of this
RotateTransition.It is not possible to change
byAngleof a runningRotateTransition. If the value ofbyAngleis changed for a runningRotateTransition, the animation has to be stopped and started again to pick up the new value.
byAngleProperty
public final DoubleProperty byAngleProperty()
RotateTransition. It is not possible to change byAngle of a running RotateTransition. If the value of byAngle is changed for a running RotateTransition, the animation has to be stopped and started again to pick up the new value.
- See Also:
-
getByAngle(),setByAngle(double)
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.