- java.lang.Object
-
- javafx.animation.Animation
-
- javafx.animation.Transition
-
- javafx.animation.RotateTransition
-
public final class RotateTransition extends Transition
ThisTransition
creates a rotation animation that spans itsduration
. This is done by updating therotate
variable of thenode
at regular interval. The angle value is specified in degrees.It starts from the
fromAngle
if provided else uses thenode
'srotate
value.It stops at the
toAngle
value if provided else it will use start value plusbyAngle
.The
toAngle
takes precedence if bothtoAngle
andbyAngle
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
Properties Type Property Description ObjectProperty<Point3D>
axis
Specifies the axis of rotation for thisRotateTransition
.DoubleProperty
byAngle
Specifies the incremented stop angle value, from the start, of thisRotateTransition
.ObjectProperty<Duration>
duration
The duration of thisRotateTransition
.DoubleProperty
fromAngle
Specifies the start angle value for thisRotateTransition
.ObjectProperty<Node>
node
The target node of thisRotateTransition
.DoubleProperty
toAngle
Specifies the stop angle value for thisRotateTransition
.-
Properties inherited from class javafx.animation.Animation
autoReverse, currentRate, currentTime, cycleCount, cycleDuration, delay, onFinished, rate, status, totalDuration
-
Properties inherited from class javafx.animation.Transition
interpolator
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javafx.animation.Animation
Animation.Status
-
-
Field Summary
-
Fields inherited from class javafx.animation.Animation
INDEFINITE
-
-
Constructor Summary
Constructors Constructor Description RotateTransition()
The constructor ofRotateTransition
RotateTransition(Duration duration)
The constructor ofRotateTransition
RotateTransition(Duration duration, Node node)
The constructor ofRotateTransition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectProperty<Point3D>
axisProperty()
Specifies the axis of rotation for thisRotateTransition
.DoubleProperty
byAngleProperty()
Specifies the incremented stop angle value, from the start, of thisRotateTransition
.ObjectProperty<Duration>
durationProperty()
The duration of thisRotateTransition
.DoubleProperty
fromAngleProperty()
Specifies the start angle value for thisRotateTransition
.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.protected void
interpolate(double frac)
The methodinterpolate()
has to be provided by implementations ofTransition
.ObjectProperty<Node>
nodeProperty()
The target node of thisRotateTransition
.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 thisRotateTransition
.-
Methods inherited from 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class javafx.animation.Transition
getCachedInterpolator, getInterpolator, getParentTargetNode, interpolatorProperty, setInterpolator
-
-
-
-
Property Detail
-
node
public final ObjectProperty<Node> 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.- See Also:
getNode()
,setNode(Node)
-
duration
public final ObjectProperty<Duration> 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
- See Also:
getDuration()
,setDuration(Duration)
-
axis
public final ObjectProperty<Point3D> 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
- See Also:
getAxis()
,setAxis(Point3D)
-
fromAngle
public final DoubleProperty 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
- See Also:
getFromAngle()
,setFromAngle(double)
-
toAngle
public final DoubleProperty 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
- See Also:
getToAngle()
,setToAngle(double)
-
byAngle
public final DoubleProperty 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.- See Also:
getByAngle()
,setByAngle(double)
-
-
Constructor Detail
-
RotateTransition
public RotateTransition(Duration duration, Node node)
The constructor ofRotateTransition
- Parameters:
duration
- The duration of theRotateTransition
node
- Thenode
which will be rotated
-
RotateTransition
public RotateTransition(Duration duration)
The constructor ofRotateTransition
- Parameters:
duration
- The duration of theRotateTransition
-
RotateTransition
public RotateTransition()
The constructor ofRotateTransition
-
-
Method Detail
-
setNode
public final void setNode(Node value)
Sets the value of the property node.- 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.
-
getNode
public final Node getNode()
Gets the value of the property node.- 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.
-
nodeProperty
public final ObjectProperty<Node> 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.- See Also:
getNode()
,setNode(Node)
-
setDuration
public final void setDuration(Duration value)
Sets the value of the property duration.- 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
-
getDuration
public final Duration getDuration()
Gets the value of the property duration.- 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
-
durationProperty
public final ObjectProperty<Duration> 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
- See Also:
getDuration()
,setDuration(Duration)
-
setAxis
public final void setAxis(Point3D value)
Sets the value of the property axis.- 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
-
getAxis
public final Point3D getAxis()
Gets the value of the property axis.- 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
-
axisProperty
public final ObjectProperty<Point3D> 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
- See Also:
getAxis()
,setAxis(Point3D)
-
setFromAngle
public final void setFromAngle(double value)
Sets the value of the property fromAngle.- 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
-
getFromAngle
public final double getFromAngle()
Gets the value of the property fromAngle.- 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
-
fromAngleProperty
public final DoubleProperty 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
- See Also:
getFromAngle()
,setFromAngle(double)
-
setToAngle
public final void setToAngle(double value)
Sets the value of the property toAngle.- 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
-
getToAngle
public final double getToAngle()
Gets the value of the property toAngle.- 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
-
toAngleProperty
public final DoubleProperty 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
- See Also:
getToAngle()
,setToAngle(double)
-
setByAngle
public final void setByAngle(double value)
Sets the value of the property byAngle.- 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.
-
getByAngle
public final double getByAngle()
Gets the value of the property byAngle.- 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.
-
byAngleProperty
public final DoubleProperty 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.- See Also:
getByAngle()
,setByAngle(double)
-
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
-
-