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.transition.*;
...
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
Animation.Status
Modifier and Type | Field and Description |
---|---|
private ObjectProperty<Point3D> |
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 ObjectProperty<Duration> |
duration
The duration of this
RotateTransition . |
private static double |
EPSILON |
private DoubleProperty |
fromAngle
Specifies the start angle value for this
RotateTransition . |
private ObjectProperty<Node> |
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 |
---|---|
ObjectProperty<Point3D> |
axisProperty() |
DoubleProperty |
byAngleProperty() |
ObjectProperty<Duration> |
durationProperty() |
DoubleProperty |
fromAngleProperty() |
Point3D |
getAxis() |
double |
getByAngle() |
Duration |
getDuration() |
double |
getFromAngle() |
Node |
getNode() |
private Node |
getTargetNode() |
double |
getToAngle() |
(package private) boolean |
impl_startable(boolean forceSync) |
(package private) void |
impl_sync(boolean forceSync) |
protected void |
interpolate(double frac)
The method
interpolate() has to be provided by implementations of
Transition . |
ObjectProperty<Node> |
nodeProperty() |
void |
setAxis(Point3D value) |
void |
setByAngle(double value) |
void |
setDuration(Duration value) |
void |
setFromAngle(double value) |
void |
setNode(Node value) |
void |
setToAngle(double value) |
DoubleProperty |
toAngleProperty() |
getCachedInterpolator, getInterpolator, getParentTargetNode, impl_jumpTo, impl_playTo, interpolatorProperty, setInterpolator
autoReverseProperty, currentRateProperty, currentTimeProperty, cycleCountProperty, cycleDurationProperty, delayProperty, getCuePoints, getCurrentRate, getCurrentTime, getCycleCount, getCycleDuration, getDelay, getOnFinished, getRate, getStatus, getTargetFramerate, getTotalDuration, impl_finished, impl_pause, impl_resume, impl_setCurrentRate, impl_setCurrentTicks, impl_start, impl_stop, impl_timePulse, isAutoReverse, jumpTo, jumpTo, onFinishedProperty, pause, pauseReceiver, play, playFrom, playFrom, playFromStart, rateProperty, resumeReceiver, setAutoReverse, setCycleCount, setCycleDuration, setDelay, setOnFinished, setRate, setStatus, startReceiver, statusProperty, stop, totalDurationProperty
private static final double EPSILON
private double start
private double delta
private ObjectProperty<Node> 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 ObjectProperty<Duration> 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 ObjectProperty<Point3D> 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 ObjectProperty<Node> nodeProperty()
public final void setDuration(Duration value)
public final Duration getDuration()
public final ObjectProperty<Duration> durationProperty()
public final void setAxis(Point3D value)
public final Point3D getAxis()
public final ObjectProperty<Point3D> axisProperty()
public final void setFromAngle(double value)
public final double getFromAngle()
public final DoubleProperty fromAngleProperty()
public final void setToAngle(double value)
public final double getToAngle()
public final DoubleProperty toAngleProperty()
public final void setByAngle(double value)
public final double getByAngle()
public final DoubleProperty byAngleProperty()
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 impl_startable(boolean forceSync)
impl_startable
in class Transition
void impl_sync(boolean forceSync)
impl_sync
in class Transition