Combining transitions

There are only two options here: ParallelTransition, which runs several animations in parallel, and SequentialTransition, which runs them one by one.

Note that these transitions work with the Animation class, which means you can combine both Transition and Timeline.

Both transitions take a node and a set of animations and apply these animations to that node unless some animation has a specific node already set for them.

There is a special transition which does nothing for a period of time: PauseTransition. Its only use is to conveniently add pauses to SequentialTransition.

Let's see it in a small example:

// chapter5/transitions/SequentialTransitionDemopublic void start(Stage primaryStage) { RotateTransition rotate = ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.