JavaFX Sequential Transition
This transition is used to apply the list of animations on a node in sequential order (one by one). Sequential Transition is important in designing a game which animates its entities in sequential order.
In JavaFX, the class javafx.animation.SequentialTransition is used to represent sequential transition. We need to pass the list of multiple transition objects into the constructor of this class. These animations will be applied on the node in the sequential order (in the order, they are passed into the constructor).
Properties
The class contains only one property which is described in the following table along with its setter method.
Property | Description | Setter Method |
---|---|---|
node | It is an object type property of the class Node. It represent the node onto which the transition is to be applied. | setNode(Node node) |
Constructors
There are four constructors in the class.
- public SequentialTransition() : creates an instance of SequentialTransition with the default parameters.
- public SequentialTransition(Animation? children) : creates an instance of SequentialTransition with the list of animations.
- public SequentialTransition(Node node) : creates an instance of sequentialTransition with specified node onto which the sequential transition will be applied.
- public SequentialTransition(Node node, Animation? children) : creates an instance of SequentialTransition with the specified node and the list of animations.
Example
In the following example, we have created a polygon and applied various transitions on it in sequential order.
Output: