Overview
This 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.*;
...
var node = Rectangle {
x: 100 y: 40
height: 100 width: 100
arcHeight: 50 arcWidth: 50
fill: Color.VIOLET
}
var rotTransition = RotateTransition {
duration: 3s node: node
byAngle: 180 repeatCount:4 autoReverse: true
}
rotTransition.play();
...
Profile: common
Variable Summary
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public | byAngle | Number | Transition.UNDEFINED |
Specifies the incremented stop angle value, from the start, of
this |
|||
public | duration | Duration | 400ms |
The length of this The length of this Profile: common |
|||
public | fromAngle | Number | Transition.UNDEFINED |
Specifies the start angle value for this |
|||
public | toAngle | Number | Transition.UNDEFINED |
Specifies the stop angle value for this |
Inherited Variables
javafx.animation.transition.Transition
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public | action | function():Void | null |
The action to be executed at the conclusion of this |
|||
public | interpolator | Interpolator | EASEBOTH |
Controls the timing for acceleration and deceleration at each transition cycle. Controls the timing for acceleration and deceleration at each transition cycle. This may only be changed prior to starting the transition or after the transition has ended. If changed during a transition then the change will not take effect until the next transition. Default interpolator is set to Interpolator#EASEBOTH. EASEBOTHProfile: common |
|||
public | node | Node | null |
The target node of this |
|||
protected | parent | Transition | subclass | subclass | subclass | null |
The parent of this The parent of this Profile: common |
javafx.animation.Timeline
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public | autoReverse | Boolean | false |
Defines whether this animation reverses direction on alternating cycles. Defines whether this animation reverses direction on alternating
cycles.
If Profile: common |
|||
public-read | currentRate | Number | 0.0 |
Read-only variable to indicate current direction/speed at which the
Read-only variable to indicate current direction/speed at which the
Profile: common |
|||
public-read protected | cycleDuration | Duration | subclass | subclass | 0ms |
Read-only variable to indicate the duration of one cycle of this
Read-only variable to indicate the duration of one cycle of this
This is set to the largest time value of its keyFrames. 0msProfile: common |
|
public-init | framerate | Number |
The maximum framerate at which this animation will run, in frames per second. The maximum framerate at which this animation will run, in frames per second. This can be used, for example, to keep particularly complex Timelines from over-consuming system resources. By default, a Timeline's framerate is not explicitly limited, meaning the Timeline will run at an optimal framerate for the underlying platform. Profile: common |
||||
public | interpolate | Boolean | true |
Enable/disable interpolation. |
|||
public | keyFrames | KeyFrame[] |
Defines the sequence of Defines the sequence of Profile: common |
||||
public-read | paused | Boolean |
Read-only var that indicates whether the animation is currently paused. Read-only var that indicates whether the animation is currently paused.
This value is initially
Note that Profile: common |
||||
public | rate | Number | 1.0 |
Defines the direction/speed at which the Defines the direction/speed at which the
The absolute value of
Rate
Inverting the rate of a running Profile: common |
|||
public | repeatCount | Number | 1.0 |
Defines the number of cycles in this animation. Defines the number of cycles in this animation.
The Profile: common |
|||
public-read | running | Boolean |
Read-only var that indicates whether the animation is currently running. Read-only var that indicates whether the animation is currently running.
This value is initially
Note that Profile: common |
||||
public | time | Duration | 0ms |
Defines the Defines the
If
If user wants to bind the variable and update it simultaneously, bidirectional
Profile: common |
|||
public-read | totalDuration | Duration | 0ms |
Read-only variable to indicate the total duration of this
Read-only variable to indicate the total duration of this
This is set to cycleDuration * repeatCount. 0msProfile: common |
Function Summary
- protected rebuildKeyFrames() : java.lang.Object[]
Inherited Functions
javafx.animation.transition.Transition
- protected getTargetNode() : Node
- protected markDirty() : Boolean
-
Subclasses invoke this function to mark the Transition as dirty and in need of rebuilding the keyFrames for the transition.
Subclasses invoke this function to mark the Transition as dirty and in need of rebuilding the keyFrames for the transition. This function only marks the state as dirty, a subsequent call to rebuild() is necessary to actually rebuild the keyframes. Generally this is done automatically when an animation is started, but can be forced if semantics require it.
-
Returns
- Boolean
- public play() : Void
- public playFromStart() : Void
-
A convenience function which plays this
Transition
from the initial position in the forward direction.A convenience function which plays this
Transition
from the initial position in the forward direction.See Timeline#playFromStart() for details.
Profile: common
- public rebuild() : Void
-
Rebuilds the keyFrames for this Transition if and only if the transition is dirty and a transition is not currently running (where 'running' includes paused transitions).
Rebuilds the keyFrames for this Transition if and only if the transition is dirty and a transition is not currently running (where 'running' includes paused transitions).
- protected abstract rebuildKeyFrames() : java.lang.Object[]
- public stop() : Void
javafx.animation.Timeline
- public pause() : Void
- public play() : Void
-
Plays
Timeline
from current position in the direction indicated byrate
.Plays
Timeline
from current position in the direction indicated byrate
. If the timeline is running, it has no effect.When
rate
> 0 (forward play), if aTimeline
is already positioned at the end, the first cycle will not be played, it is considered to have already finished. This also applies to a backward (rate
< 0) cycle if a timeline is positioned at the beginning. However, if theTimeline
hasrepeatCount
> 1, following cycle(s) will be played as usual.When
Timeline
reaches the end,Timeline
is stopped and the play head remains at the end.To play a
Timeline
backwards from the end:
timeline.rate = negative rate
timeline.time = overall duration of timeline
timeline.play()
Note:
play()
is an asynchronous call,Timeline
may not start immediately.Profile: common
- public playFromStart() : Void
-
Plays timeline from initial position in forward direction.
Plays timeline from initial position in forward direction.
It is equivalent to
timeline.stop();
timeline.rate = Math.abs(timeline.rate); timeline.time = 0.0s;
timeline.play();
Note:
playFromStart()
is an asynchronous call,Timeline
may not start immediately.Profile: common
- public stop() : Void
-
Stops the animation and resets the play head to its initial position.
Stops the animation and resets the play head to its initial position. If the animation is not currently running, this method has no effect.
Note:
stop()
is an asynchronous call, timeline may not stop immediately.Profile: common