Java Reference
In-Depth Information
Table 2-1. Transition Classes in the javafx.animation Package for Animating Nodes
Transition Class Name
Description
TranslateTransition
Translates (moves) a node from one location to another over a given period of time.
This was employed in the Hello Earthrise example program in Chapter 1.
PathTransition
Moves a node along a specified path.
RotateTransition
Rotates a node over a given period of time.
ScaleTransition
Scales (increases or decreases the size of ) a node over a given period of time.
FadeTransition
Fades (increases or decreases the opacity of ) a node over a given period of time.
FillTransition
Changes the fill of a shape over a given period of time.
StrokeTransition
Changes the stroke color of a shape over a given period of time.
PauseTransition
Executes an action at the end of its duration; designed mainly to be used in a
SequentialTransition as a means to wait for a period of time.
SequentialTransition
Allows you to define a series of transitions that execute sequentially.
ParallelTransition
Allows you to define a series of transitions that execute in parallel.
Let's take a look at a variation on the metronome theme in which we create a metronome using
TranslateTransition for the animation.
The MetronomeTransition Example
When using the transition classes, we take a different approach toward animation than when using the Timeline
class directly:
TIn the timeline-based Metronome1 program, we bound a property of a node (specifically,
startX ) to a property in the model ( startXVal ), and then used the timeline to interpolate the
value of the property in the model.
Transition
subclass, one of which is a node. The net result is that the node itself is affected, rather than
just a bound attribute of the node being affected.
When using a transition class, however, we assign values to the properties of the
The distinction between these two approaches becomes clear as we walk through the MetronomeTransition
example. Figure 2-9 shows a screenshot of this program when it is first invoked.
 
Search WWH ::




Custom Search