- java.lang.Object
-
- javafx.animation.Animation
-
- javafx.animation.Transition
-
- javafx.animation.RotateTransition
-
public final class RotateTransition extends Transition
这Transition创建一个旋转动画,跨越其duration。 这是通过更新完成rotate的可变node在固定时间间隔。 角度值以度为单位。它从
fromAngle开始,如果提供的其他使用node的rotate值。如果提供的话,它将停止在
toAngle值,否则将使用起始值加上byAngle。如果指定了
toAngle和byAngle则toAngle将优先。代码段示例:
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(); ...- 从以下版本开始:
- JavaFX 2.0
- 另请参见:
-
Transition,Animation
-
-
Property Summary
Properties Type Property 描述 ObjectProperty<Point3D>axis指定RotateTransition的旋转轴。DoublePropertybyAngle指定从这个RotateTransition开始的递增停止角度值。ObjectProperty<Duration>duration这个RotateTransition的持续时间。DoublePropertyfromAngle指定此RotateTransition的起始角度值。ObjectProperty<Node>node这个RotateTransition的目标节点。DoublePropertytoAngle指定此RotateTransition的停止角度值。-
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 描述 RotateTransition()构造函数为RotateTransitionRotateTransition(Duration duration)构造函数为RotateTransitionRotateTransition(Duration duration, Node node)构造函数为RotateTransition
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 ObjectProperty<Point3D>axisProperty()指定RotateTransition的旋转轴。DoublePropertybyAngleProperty()指定从这个RotateTransition开始的递增停止角度值。ObjectProperty<Duration>durationProperty()这个RotateTransition的持续时间。DoublePropertyfromAngleProperty()指定此RotateTransition的起始角度值。Point3DgetAxis()获取属性轴的值。doublegetByAngle()获取属性的值byAngle。DurationgetDuration()获取属性持续时间的值。doublegetFromAngle()获取属性fromAngle的值。NodegetNode()获取属性节点的值。doublegetToAngle()获取属性的值为Agle。protected voidinterpolate(double frac)方法interpolate()必须由Transition的实现来提供。ObjectProperty<Node>nodeProperty()这个RotateTransition的目标节点。voidsetAxis(Point3D value)设置属性轴的值。voidsetByAngle(double value)设置属性的值byAngle。voidsetDuration(Duration value)设置属性持续时间的值。voidsetFromAngle(double value)设置属性fromAngle的值。voidsetNode(Node value)设置属性节点的值。voidsetToAngle(double value)将属性的值设置为Agle。DoublePropertytoAngleProperty()指定此RotateTransition的停止角度值。-
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
该目标节点为RotateTransition。这是不可能改变目标
node正在运行的RotateTransition。 如果node的值更改为运行中的RotateTransition,则动画必须停止并重新开始以获取新值。- 另请参见:
-
getNode(),setNode(Node)
-
duration
public final ObjectProperty<Duration> durationProperty
这个RotateTransition的持续时间。无法更改
duration的运行中的RotateTransition。 如果值duration改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。注意:
duration的单位为毫秒,粒度取决于底层操作系统,通常会较大。 例如,桌面系统上的动画通常运行时间最多为60fps,粒度为〜17 ms。 设定持续时间低于Duration.ZERO将导致IllegalArgumentException。- Default value:
- 400毫秒
- 另请参见:
-
getDuration(),setDuration(Duration)
-
axis
public final ObjectProperty<Point3D> axisProperty
指定RotateTransition的旋转轴。 如果这个axis为空,请使用node.rotationAxis作为旋转轴。不可能更改
axis的一个正在运行的RotateTransition。 如果值axis改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- Default value:
- 空值
- 另请参见:
-
getAxis(),setAxis(Point3D)
-
fromAngle
public final DoubleProperty fromAngleProperty
指定此RotateTransition的起始角度值。无法更改
fromAngle的一个正在运行的RotateTransition。 如果值fromAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- Default value:
-
Double.NaN - 另请参见:
-
getFromAngle(),setFromAngle(double)
-
toAngle
public final DoubleProperty toAngleProperty
指定RotateTransition的停止角度值。不可能更改
toAngle的一个正在运行的RotateTransition。 如果值toAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- Default value:
-
Double.NaN - 另请参见:
-
getToAngle(),setToAngle(double)
-
byAngle
public final DoubleProperty byAngleProperty
从这个RotateTransition开始指定递增的停止角度值。无法更改
byAngle的正在运行的RotateTransition。 如果byAngle的值更改为运行中的RotateTransition,则动画必须停止并重新开始以获取新值。- 另请参见:
-
getByAngle(),setByAngle(double)
-
-
构造方法详细信息
-
RotateTransition
public RotateTransition(Duration duration, Node node)
构造函数为RotateTransition- 参数
-
duration- 持续时间RotateTransition -
node- 将旋转node
-
RotateTransition
public RotateTransition(Duration duration)
构造函数为RotateTransition- 参数
-
duration- 持续时间RotateTransition
-
RotateTransition
public RotateTransition()
构造函数为RotateTransition
-
-
方法详细信息
-
setNode
public final void setNode(Node value)
设置属性节点的值。- Property description:
-
这个
RotateTransition的目标节点。这是不可能改变目标
node正在运行的RotateTransition。 如果为运行的RotateTransition更改了node的值,则必须停止动画并重新启动以获取新值。
-
getNode
public final Node getNode()
获取属性节点的值。- Property description:
-
这个
RotateTransition的目标节点。这是不可能改变目标
node正在运行的RotateTransition。 如果值node改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。
-
nodeProperty
public final ObjectProperty<Node> nodeProperty()
这个RotateTransition的目标节点。这是不可能改变目标
node正在运行的RotateTransition。 如果值node改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- 另请参见:
-
getNode(),setNode(Node)
-
setDuration
public final void setDuration(Duration value)
设置属性持续时间的值。- Property description:
-
持续时间
RotateTransition。不可能更改
duration的一个正在运行的RotateTransition。 如果值duration改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。注意:
duration的单位是毫秒,粒度取决于底层的操作系统,一般会更大。 例如,桌面系统上的动画通常运行时间最多为60fps,粒度为〜17 ms。 设定持续时间低于Duration.ZERO将导致IllegalArgumentException。 - Default value:
- 400毫秒
-
getDuration
public final Duration getDuration()
获取属性持续时间的值。- Property description:
-
这个
RotateTransition的持续时间。这是不可能改变
duration正在运行的RotateTransition。 如果值duration改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。注意:
duration的单位为毫秒,粒度取决于底层的操作系统,一般会较大。 例如,桌面系统上的动画通常运行时间最多为60fps,粒度为〜17 ms。 将持续时间设置为低于Duration.ZERO将导致IllegalArgumentException。 - Default value:
- 400毫秒
-
durationProperty
public final ObjectProperty<Duration> durationProperty()
这个RotateTransition的持续时间。不可能更改
duration运行的RotateTransition。 如果duration的值更改为运行中的RotateTransition,则动画必须停止并再次启动才能获取新值。注意:
duration的单位是毫秒级,粒度取决于底层的操作系统,通常会更大。 例如,桌面系统上的动画通常运行时间最多为60fps,粒度为〜17 ms。 设定持续时间低于Duration.ZERO将导致IllegalArgumentException。- Default value:
- 400毫秒
- 另请参见:
-
getDuration(),setDuration(Duration)
-
setAxis
public final void setAxis(Point3D value)
设置属性轴的值。- Property description:
-
指定此
RotateTransition的旋转轴。 如果axis为空,则使用node.rotationAxis作为旋转轴。不可能更改
axis的一个正在运行的RotateTransition。 如果值axis改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。 - Default value:
- 空值
-
getAxis
public final Point3D getAxis()
获取属性轴的值。- Property description:
-
指定此
RotateTransition的旋转轴。 如果这个axis为空,请使用node.rotationAxis作为旋转轴。这是不可能改变
axis正在运行的RotateTransition。 如果axis的值更改为运行中的RotateTransition,则必须停止动画并再次启动以获取新值。 - Default value:
- 空值
-
axisProperty
public final ObjectProperty<Point3D> axisProperty()
指定RotateTransition的旋转轴。 如果axis为空,则使用node.rotationAxis作为旋转轴。无法更改
axis运行的RotateTransition。 如果值axis改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- Default value:
- 空值
- 另请参见:
-
getAxis(),setAxis(Point3D)
-
setFromAngle
public final void setFromAngle(double value)
设置属性fromAngle的值。- Property description:
-
指定此
RotateTransition的起始角度值。不可能更改
fromAngle的一个正在运行的RotateTransition。 如果为运行的RotateTransition更改了fromAngle的值,则必须停止动画并重新启动以获取新值。 - Default value:
-
Double.NaN
-
getFromAngle
public final double getFromAngle()
获取属性fromAngle的值。- Property description:
-
指定此
RotateTransition的起始角度值。无法更改
fromAngle的运行中的RotateTransition。 如果fromAngle的值更改为RotateTransition,则动画必须停止并重新开始以获取新值。 - Default value:
-
Double.NaN
-
fromAngleProperty
public final DoubleProperty fromAngleProperty()
指定此RotateTransition的起始角度值。不可能更改
fromAngle的一个正在运行的RotateTransition。 如果值fromAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- Default value:
-
Double.NaN - 另请参见:
-
getFromAngle(),setFromAngle(double)
-
setToAngle
public final void setToAngle(double value)
将属性的值设置为Agle。- Property description:
-
指定此
RotateTransition的停止角度值。不可能更改
toAngle的一个正在运行的RotateTransition。 如果值toAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。 - Default value:
-
Double.NaN
-
getToAngle
public final double getToAngle()
获取属性的值为Agle。- Property description:
-
指定
RotateTransition的停止角度值。无法更改
toAngle的一个正在运行的RotateTransition。 如果值toAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。 - Default value:
-
Double.NaN
-
toAngleProperty
public final DoubleProperty toAngleProperty()
指定此RotateTransition的停止角度值。无法更改
toAngle的一个正在运行的RotateTransition。 如果值toAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- Default value:
-
Double.NaN - 另请参见:
-
getToAngle(),setToAngle(double)
-
setByAngle
public final void setByAngle(double value)
设置属性的值byAngle。- Property description:
-
从这个
RotateTransition开始指定递增的停止角度值。无法更改
byAngle的一个正在运行的RotateTransition。 如果值byAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。
-
getByAngle
public final double getByAngle()
获取属性的值byAngle。- Property description:
-
指定从这个
RotateTransition开始的递增停止角度值。无法更改
byAngle的一个正在运行的RotateTransition。 如果值byAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。
-
byAngleProperty
public final DoubleProperty byAngleProperty()
指定从这个RotateTransition开始的递增停止角度值。无法更改
byAngle的一个正在运行的RotateTransition。 如果值byAngle改变正在运行的RotateTransition,动画必须停止并重新开始拿起新的价值。- 另请参见:
-
getByAngle(),setByAngle(double)
-
interpolate
protected void interpolate(double frac)
方法interpolate()必须由Transition的实现来提供。 当一个Transition正在运行时,这个方法在每个帧中被调用。 该参数用动画定义当前位置。 一开始,分数将为0.0,最终将为1.0。 参数如何增加,取决于interpolator,例如如果interpolator是Interpolator.LINEAR,则分数会增加线性。 该方法不能直接由用户调用。- Specified by:
-
interpolate在Transition - 参数
-
frac- 相对位置
-
-