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:
-
Property Summary
TypePropertyDescriptionfinal ObjectProperty<Point3D>
Specifies the axis of rotation for thisRotateTransition
.final DoubleProperty
Specifies the incremented stop angle value, from the start, of thisRotateTransition
.final ObjectProperty<Duration>
The duration of thisRotateTransition
.final DoubleProperty
Specifies the start angle value for thisRotateTransition
.final ObjectProperty<Node>
The target node of thisRotateTransition
.final DoubleProperty
Specifies the stop angle value for thisRotateTransition
.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
ConstructorDescriptionThe constructor ofRotateTransition
RotateTransition
(Duration duration) The constructor ofRotateTransition
RotateTransition
(Duration duration, Node node) The constructor ofRotateTransition
-
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty<Point3D>
Specifies the axis of rotation for thisRotateTransition
.final DoubleProperty
Specifies the incremented stop angle value, from the start, of thisRotateTransition
.final ObjectProperty<Duration>
The duration of thisRotateTransition
.final DoubleProperty
Specifies the start angle value for thisRotateTransition
.final Point3D
getAxis()
Gets the value of theaxis
property.final double
Gets the value of thebyAngle
property.final Duration
Gets the value of theduration
property.final double
Gets the value of thefromAngle
property.final Node
getNode()
Gets the value of thenode
property.final double
Gets the value of thetoAngle
property.protected void
interpolate
(double frac) The methodinterpolate()
has to be provided by implementations ofTransition
.final ObjectProperty<Node>
The target node of thisRotateTransition
.final void
Sets the value of theaxis
property.final void
setByAngle
(double value) Sets the value of thebyAngle
property.final void
setDuration
(Duration value) Sets the value of theduration
property.final void
setFromAngle
(double value) Sets the value of thefromAngle
property.final void
Sets the value of thenode
property.final void
setToAngle
(double value) Sets the value of thetoAngle
property.final DoubleProperty
Specifies the stop angle value for thisRotateTransition
.Methods declared in class javafx.animation.Transition
getCachedInterpolator, getInterpolator, getParentTargetNode, 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
The target node of thisRotateTransition
.It is not possible to change the target
node
of a runningRotateTransition
. If the value ofnode
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- See Also:
-
duration
The duration of thisRotateTransition
.It is not possible to change the
duration
of a runningRotateTransition
. If the value ofduration
is changed for a runningRotateTransition
, 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 thanDuration.ZERO
will result inIllegalArgumentException
.- Default value:
- 400ms
- See Also:
-
axis
Specifies the axis of rotation for thisRotateTransition
. Usenode.rotationAxis
for axis of rotation if thisaxis
is null.It is not possible to change the
axis
of a runningRotateTransition
. If the value ofaxis
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Default value:
- null
- See Also:
-
fromAngle
Specifies the start angle value for thisRotateTransition
.It is not possible to change
fromAngle
of a runningRotateTransition
. If the value offromAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Default value:
Double.NaN
- See Also:
-
toAngle
Specifies the stop angle value for thisRotateTransition
.It is not possible to change
toAngle
of a runningRotateTransition
. If the value oftoAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Default value:
Double.NaN
- See Also:
-
byAngle
Specifies the incremented stop angle value, from the start, of thisRotateTransition
.It is not possible to change
byAngle
of a runningRotateTransition
. If the value ofbyAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- See Also:
-
-
Constructor Details
-
RotateTransition
The constructor ofRotateTransition
- Parameters:
duration
- The duration of theRotateTransition
node
- Thenode
which will be rotated
-
RotateTransition
The constructor ofRotateTransition
- Parameters:
duration
- The duration of theRotateTransition
-
RotateTransition
public RotateTransition()The constructor ofRotateTransition
-
-
Method Details
-
setNode
Sets the value of thenode
property.- Property description:
- The target node of this
RotateTransition
.It is not possible to change the target
node
of a runningRotateTransition
. If the value ofnode
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Parameters:
value
- the value for thenode
property- See Also:
-
getNode
Gets the value of thenode
property.- Property description:
- The target node of this
RotateTransition
.It is not possible to change the target
node
of a runningRotateTransition
. If the value ofnode
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Returns:
- the value of the
node
property - See Also:
-
nodeProperty
The target node of thisRotateTransition
.It is not possible to change the target
node
of a runningRotateTransition
. If the value ofnode
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Returns:
- the
node
property - See Also:
-
setDuration
Sets the value of theduration
property.- Property description:
- The duration of this
RotateTransition
.It is not possible to change the
duration
of a runningRotateTransition
. If the value ofduration
is changed for a runningRotateTransition
, 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 thanDuration.ZERO
will result inIllegalArgumentException
. - Default value:
- 400ms
- Parameters:
value
- the value for theduration
property- See Also:
-
getDuration
Gets the value of theduration
property.- Property description:
- The duration of this
RotateTransition
.It is not possible to change the
duration
of a runningRotateTransition
. If the value ofduration
is changed for a runningRotateTransition
, 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 thanDuration.ZERO
will result inIllegalArgumentException
. - Default value:
- 400ms
- Returns:
- the value of the
duration
property - See Also:
-
durationProperty
The duration of thisRotateTransition
.It is not possible to change the
duration
of a runningRotateTransition
. If the value ofduration
is changed for a runningRotateTransition
, 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 thanDuration.ZERO
will result inIllegalArgumentException
.- Default value:
- 400ms
- Returns:
- the
duration
property - See Also:
-
setAxis
Sets the value of theaxis
property.- Property description:
- Specifies the axis of rotation for this
RotateTransition
. Usenode.rotationAxis
for axis of rotation if thisaxis
is null.It is not possible to change the
axis
of a runningRotateTransition
. If the value ofaxis
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Default value:
- null
- Parameters:
value
- the value for theaxis
property- See Also:
-
getAxis
Gets the value of theaxis
property.- Property description:
- Specifies the axis of rotation for this
RotateTransition
. Usenode.rotationAxis
for axis of rotation if thisaxis
is null.It is not possible to change the
axis
of a runningRotateTransition
. If the value ofaxis
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Default value:
- null
- Returns:
- the value of the
axis
property - See Also:
-
axisProperty
Specifies the axis of rotation for thisRotateTransition
. Usenode.rotationAxis
for axis of rotation if thisaxis
is null.It is not possible to change the
axis
of a runningRotateTransition
. If the value ofaxis
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Default value:
- null
- Returns:
- the
axis
property - See Also:
-
setFromAngle
public final void setFromAngle(double value) Sets the value of thefromAngle
property.- Property description:
- Specifies the start angle value for this
RotateTransition
.It is not possible to change
fromAngle
of a runningRotateTransition
. If the value offromAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
- Parameters:
value
- the value for thefromAngle
property- See Also:
-
getFromAngle
public final double getFromAngle()Gets the value of thefromAngle
property.- Property description:
- Specifies the start angle value for this
RotateTransition
.It is not possible to change
fromAngle
of a runningRotateTransition
. If the value offromAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
- Returns:
- the value of the
fromAngle
property - See Also:
-
fromAngleProperty
Specifies the start angle value for thisRotateTransition
.It is not possible to change
fromAngle
of a runningRotateTransition
. If the value offromAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Default value:
Double.NaN
- Returns:
- the
fromAngle
property - See Also:
-
setToAngle
public final void setToAngle(double value) Sets the value of thetoAngle
property.- Property description:
- Specifies the stop angle value for this
RotateTransition
.It is not possible to change
toAngle
of a runningRotateTransition
. If the value oftoAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
- Parameters:
value
- the value for thetoAngle
property- See Also:
-
getToAngle
public final double getToAngle()Gets the value of thetoAngle
property.- Property description:
- Specifies the stop angle value for this
RotateTransition
.It is not possible to change
toAngle
of a runningRotateTransition
. If the value oftoAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Default value:
Double.NaN
- Returns:
- the value of the
toAngle
property - See Also:
-
toAngleProperty
Specifies the stop angle value for thisRotateTransition
.It is not possible to change
toAngle
of a runningRotateTransition
. If the value oftoAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Default value:
Double.NaN
- Returns:
- the
toAngle
property - See Also:
-
setByAngle
public final void setByAngle(double value) Sets the value of thebyAngle
property.- Property description:
- Specifies the incremented stop angle value, from the start, of this
RotateTransition
.It is not possible to change
byAngle
of a runningRotateTransition
. If the value ofbyAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Parameters:
value
- the value for thebyAngle
property- See Also:
-
getByAngle
public final double getByAngle()Gets the value of thebyAngle
property.- Property description:
- Specifies the incremented stop angle value, from the start, of this
RotateTransition
.It is not possible to change
byAngle
of a runningRotateTransition
. If the value ofbyAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value. - Returns:
- the value of the
byAngle
property - See Also:
-
byAngleProperty
Specifies the incremented stop angle value, from the start, of thisRotateTransition
.It is not possible to change
byAngle
of a runningRotateTransition
. If the value ofbyAngle
is changed for a runningRotateTransition
, the animation has to be stopped and started again to pick up the new value.- Returns:
- the
byAngle
property - See Also:
-
interpolate
protected void interpolate(double frac) The methodinterpolate()
has to be provided by implementations ofTransition
. While aTransition
is running, this method is called in every frame. The parameter defines the current position with the animation. At the start, the fraction will be0.0
and at the end it will be1.0
. How the parameter increases, depends on theinterpolator
, e.g. if theinterpolator
isInterpolator.LINEAR
, the fraction will increase linear. This method must not be called by the user directly.- Specified by:
interpolate
in classTransition
- Parameters:
frac
- The relative position
-