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
INDEFINITE
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() |
double |
getToAngle() |
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, interpolatorProperty, setInterpolator
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
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 positionCopyright © 2020. All rights reserved.