Top Description Fields Constructors Methods
javafx.animation

public final Class RotateTransition

extends Transition
Class Inheritance
Imports
javafx.beans.property.DoubleProperty, .ObjectProperty, .ObjectPropertyBase, .SimpleDoubleProperty, .SimpleObjectProperty, javafx.geometry.Point3D, javafx.scene.Node, javafx.util.Duration

This Transition creates a rotation animation that spans its duration. This is done by updating the rotate variable of the node at regular intervals. 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
Transition, Animation

Field Summary

Modifier and TypeField 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
private static final Point3D
private static final double
private static final Duration
private static final double
private static final Node
private static final double
private double
private ObjectProperty<Duration>
duration

The duration of this RotateTransition.

private static final double
private DoubleProperty
fromAngle

Specifies the start angle value for this RotateTransition.

private ObjectProperty<Node>
node

The target node of this RotateTransition.

private double
private DoubleProperty
toAngle

Specifies the stop angle value for this RotateTransition.

Constructor Summary

AccessConstructor and Description
public
RotateTransition(Duration
The duration of the RotateTransition
duration
,
Node
The node which will be rotated
node
)

The constructor of RotateTransition

public
RotateTransition(Duration
The duration of the RotateTransition
duration
)

The constructor of RotateTransition

public
RotateTransition()

The constructor of RotateTransition

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Point3D>
public final DoubleProperty
public final ObjectProperty<Duration>
public final DoubleProperty
public final Point3D
public final double
public final Duration
public final double
public final Node
private Node
public final double
protected void
interpolate(double
The relative position
frac
)

Implements abstract javafx.animation.Transition.interpolate.

The method interpolate() has to be provided by implementations of Transition.

public final ObjectProperty<Node>
public final void
public final void
setByAngle(double value)

public final void
public final void
setFromAngle(double value)

public final void
setNode(Node value)

public final void
setToAngle(double value)

pack-priv boolean
startable(boolean forceSync)

Overrides javafx.animation.Transition.startable.

pack-priv void
sync(boolean forceSync)

Overrides javafx.animation.Transition.sync.

public final DoubleProperty
Inherited from javafx.animation.Transition:
doJumpTodoPlayTogetCachedInterpolatorgetInterpolatorgetParentTargetNodeinterpolatorPropertysetInterpolator

Field Detail

axisback to summary
private ObjectProperty<Point3D> axis

Specifies the axis of rotation for this 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.

Default Value
null
byAngleback to summary
private DoubleProperty byAngle

Specifies the incremented stop angle value, from the start, of this 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.

cachedNodeback to summary
private Node cachedNode
DEFAULT_AXISback to summary
private static final Point3D DEFAULT_AXIS
DEFAULT_BY_ANGLEback to summary
private static final double DEFAULT_BY_ANGLE
DEFAULT_DURATIONback to summary
private static final Duration DEFAULT_DURATION
DEFAULT_FROM_ANGLEback to summary
private static final double DEFAULT_FROM_ANGLE
DEFAULT_NODEback to summary
private static final Node DEFAULT_NODE
DEFAULT_TO_ANGLEback to summary
private static final double DEFAULT_TO_ANGLE
deltaback to summary
private double delta
durationback to summary
private ObjectProperty<Duration> duration

The duration of this 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.

Default Value
400ms
EPSILONback to summary
private static final double EPSILON

Hides javafx.animation.Animation.EPSILON.

fromAngleback to summary
private DoubleProperty fromAngle

Specifies the start angle value for this 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.

Default Value
Double.NaN
nodeback to summary
private ObjectProperty<Node> node

The target node of this 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.

startback to summary
private double start
toAngleback to summary
private DoubleProperty toAngle

Specifies the stop angle value for this 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.

Default Value
Double.NaN

Constructor Detail

RotateTransitionback to summary
public RotateTransition(Duration duration, Node node)

The constructor of RotateTransition

Parameters
duration:Duration

The duration of the RotateTransition

node:Node

The node which will be rotated

RotateTransitionback to summary
public RotateTransition(Duration duration)

The constructor of RotateTransition

Parameters
duration:Duration

The duration of the RotateTransition

RotateTransitionback to summary
public RotateTransition()

The constructor of RotateTransition

Method Detail

axisPropertyback to summary
public final ObjectProperty<Point3D> axisProperty()
byAnglePropertyback to summary
public final DoubleProperty byAngleProperty()
durationPropertyback to summary
public final ObjectProperty<Duration> durationProperty()
fromAnglePropertyback to summary
public final DoubleProperty fromAngleProperty()
getAxisback to summary
public final Point3D getAxis()
getByAngleback to summary
public final double getByAngle()
getDurationback to summary
public final Duration getDuration()
getFromAngleback to summary
public final double getFromAngle()
getNodeback to summary
public final Node getNode()
getTargetNodeback to summary
private Node getTargetNode()
getToAngleback to summary
public final double getToAngle()
interpolateback to summary
protected void interpolate(double frac)

Implements abstract javafx.animation.Transition.interpolate.

Doc from javafx.animation.Transition.interpolate.

The method 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.

Parameters
frac:double

The relative position

Annotations
@Override
nodePropertyback to summary
public final ObjectProperty<Node> nodeProperty()
setAxisback to summary
public final void setAxis(Point3D value)
setByAngleback to summary
public final void setByAngle(double value)
setDurationback to summary
public final void setDuration(Duration value)
setFromAngleback to summary
public final void setFromAngle(double value)
setNodeback to summary
public final void setNode(Node value)
setToAngleback to summary
public final void setToAngle(double value)
startableback to summary
pack-priv boolean startable(boolean forceSync)

Overrides javafx.animation.Transition.startable.

Annotations
@Override
syncback to summary
pack-priv void sync(boolean forceSync)

Overrides javafx.animation.Transition.sync.

Annotations
@Override
toAnglePropertyback to summary
public final DoubleProperty toAngleProperty()