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();
...
Transition
,
Animation
Type | Property and Description |
---|---|
<any> |
axis
Specifies the axis of rotation for this
RotateTransition . |
DoubleProperty |
byAngle
Specifies the incremented stop angle value, from the start, of this
RotateTransition . |
<any> |
duration
The duration of this
RotateTransition . |
DoubleProperty |
fromAngle
Specifies the start angle value for this
RotateTransition . |
<any> |
node
The target node of this
RotateTransition . |
DoubleProperty |
toAngle
Specifies the stop angle value for this
RotateTransition . |
interpolatorProperty
autoReverseProperty, currentRateProperty, currentTimeProperty, cycleCountProperty, cycleDurationProperty, delayProperty, onFinishedProperty, rateProperty, statusProperty, totalDurationProperty
Animation.Status
Modifier and Type | Field and Description |
---|---|
private <any> |
axis
Specifies the axis of rotation for this
RotateTransition . |
private DoubleProperty |
byAngle
Specifies the incremented stop angle value, from the start, of this
RotateTransition . |
private Node |
cachedNode |
private static Point3D |
DEFAULT_AXIS |
private static double |
DEFAULT_BY_ANGLE |
private static Duration |
DEFAULT_DURATION |
private static double |
DEFAULT_FROM_ANGLE |
private static Node |
DEFAULT_NODE |
private static double |
DEFAULT_TO_ANGLE |
private double |
delta |
private <any> |
duration
The duration of this
RotateTransition . |
private static double |
EPSILON |
private DoubleProperty |
fromAngle
Specifies the start angle value for this
RotateTransition . |
private <any> |
node
The target node of this
RotateTransition . |
private double |
start |
private DoubleProperty |
toAngle
Specifies the stop angle value for this
RotateTransition . |
clipEnvelope, INDEFINITE, parent, pulseReceiver
Constructor and Description |
---|
RotateTransition()
The constructor of
RotateTransition |
RotateTransition(Duration duration)
The constructor of
RotateTransition |
RotateTransition(Duration duration,
Node node)
The constructor of
RotateTransition |
Modifier and Type | Method and Description |
---|---|
<any> |
axisProperty()
Specifies the axis of rotation for this
RotateTransition . |
DoubleProperty |
byAngleProperty()
Specifies the incremented stop angle value, from the start, of this
RotateTransition . |
<any> |
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.
|
private Node |
getTargetNode() |
double |
getToAngle()
Gets the value of the property toAngle.
|
protected void |
interpolate(double frac)
The method
interpolate() has to be provided by implementations of
Transition . |
<any> |
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.
|
(package private) boolean |
startable(boolean forceSync) |
(package private) void |
sync(boolean forceSync) |
DoubleProperty |
toAngleProperty()
Specifies the stop angle value for this
RotateTransition . |
doJumpTo, doPlayTo, getCachedInterpolator, getInterpolator, getParentTargetNode, interpolatorProperty, setInterpolator
autoReverseProperty, currentRateProperty, currentTimeProperty, cycleCountProperty, cycleDurationProperty, delayProperty, doPause, doResume, doStart, doStop, doTimePulse, finished, getCuePoints, getCurrentRate, getCurrentTime, getCycleCount, getCycleDuration, getDelay, getOnFinished, getRate, getStatus, getTargetFramerate, getTotalDuration, isAutoReverse, jumpTo, onFinishedProperty, pause, pauseReceiver, play, playFrom, playFrom, playFromStart, rateProperty, resumeReceiver, setAutoReverse, setCurrentRate, setCurrentTicks, setCycleCount, setCycleDuration, setDelay, setOnFinished, setRate, setStatus, startReceiver, statusProperty, stop, totalDurationProperty
public final <any> 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.
getNode()
,
setNode(Node)
public final <any> 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
.
getDuration()
,
setDuration(Duration)
public final <any> 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.
getAxis()
,
setAxis(Point3D)
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.
getFromAngle()
,
setFromAngle(double)
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.
getToAngle()
,
setToAngle(double)
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.
getByAngle()
,
setByAngle(double)
private static final double EPSILON
private double start
private double delta
private <any> node
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.
private static final Node DEFAULT_NODE
private Node cachedNode
private <any> duration
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
.
private static final Duration DEFAULT_DURATION
private <any> axis
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.
private static final Point3D DEFAULT_AXIS
private DoubleProperty fromAngle
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.
private static final double DEFAULT_FROM_ANGLE
private DoubleProperty toAngle
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.
private static final double DEFAULT_TO_ANGLE
private DoubleProperty byAngle
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.
private static final double DEFAULT_BY_ANGLE
public RotateTransition(Duration duration, Node node)
RotateTransition
duration
- The duration of the RotateTransition
node
- The node
which will be rotatedpublic RotateTransition(Duration duration)
RotateTransition
duration
- The duration of the RotateTransition
public RotateTransition()
RotateTransition
public final void setNode(Node value)
public final Node getNode()
public final <any> 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.
getNode()
,
setNode(Node)
public final void setDuration(Duration value)
public final Duration getDuration()
public final <any> 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
.
getDuration()
,
setDuration(Duration)
public final void setAxis(Point3D value)
public final Point3D getAxis()
public final <any> 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.
getAxis()
,
setAxis(Point3D)
public final void setFromAngle(double value)
public final double getFromAngle()
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.
getFromAngle()
,
setFromAngle(double)
public final void setToAngle(double value)
public final double getToAngle()
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.
getToAngle()
,
setToAngle(double)
public final void setByAngle(double value)
public final double getByAngle()
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.
getByAngle()
,
setByAngle(double)
protected void interpolate(double frac)
interpolate()
has to be provided by implementations of
Transition
. While a Transition
is running, this method is
called in every frame.
The parameter defines the current position with the animation. At the
start, the fraction will be 0.0
and at the end it will be
1.0
. How the parameter increases, depends on the
interpolator
, e.g. if the
interpolator
is Interpolator.LINEAR
, the fraction will
increase linear.
This method must not be called by the user directly.interpolate
in class Transition
frac
- The relative positionprivate Node getTargetNode()
boolean startable(boolean forceSync)
startable
in class Transition
void sync(boolean forceSync)
sync
in class Transition