Constructors
There are two constructors in the JavaFX class:
1. public PauseTransition(): It creates a new PauseTransition instance with the default parameters.
2. public PauseTransition(Duration duration): It creates a new instance of PauseTransition with the duration specified in the parameters.
Implementation of JavaFX Pause Transition
package application;
import javafx.animation.FadeTransition;
import javafx.animation.PauseTransition;
import javafx.animation.RotateTransition;
import javafx.animation.SequentialTransition;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.stage.Stage;
import javafx.util.Duration;
public class Pause_Transition extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
// TODO Auto-generated method stub
//Creating polygon
Polygon poly = new Polygon();
poly.getPoints().addAll(new Double[]{320.0,270.0,270.0,220.0,270.0,270.0,320.0,120.0,370.0,270.0,370.0,220.0});
//Setting Color and Stroke properties for the polygon
poly.setFill(Color.LIMEGREEN);
poly.setStroke(Color.BLACK);
//Setting Rotate Transition
RotateTransition rt = new RotateTransition(Duration.millis(500),poly);
rt.setByAngle(180);
rt.setCycleCount(2);
rt.setAutoReverse(true);
//Setting Translate Transition
TranslateTransition translate = new TranslateTransition(Duration.millis(500),poly);
translate.setToX(-150f);
translate.setCycleCount(2);
translate.setAutoReverse(true);
//Setting Fade Transition
FadeTransition fade = new FadeTransition(Duration.millis(500),poly);
fade.setFromValue(1.0f);
fade.setToValue(0.5f);
fade.setCycleCount(2);
fade.setAutoReverse(true);
//Setting Sequential Transition and pause after each transition passed in the list
SequentialTransition seqTransition = new SequentialTransition (fade,new PauseTransition(Duration.millis(2000)),rt,
new PauseTransition(Duration.millis(2000)),translate);
//Playing Sequential Transition
seqTransition.play();
//Setting Group and scene
Group root = new Group();
root.getChildren().addAll(poly);
Scene scene = new Scene(root,490,300,Color.WHEAT);
primaryStage.setScene(scene);
primaryStage.setTitle("Pause Transition Example");
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

You can also try this code with Online Java Compiler
Run Code
How To Execute
To execute the above program. You can follow the given steps:
-
Open the terminal in the same folder where you have saved your source code.
-
Enter the below code and hit enter.
javac --module-path path/to/your/javaFx/modules --add-modules javafx.fxml,javafx.controls filename.java
-
After you hit enter a new file will automatically be generated namely filename.class
-
Now, enter the below command and hit enter to execute the above program.
java --module-path path/to/your/javaFx/modules --add-modules javafx.fxml,javafx.controls filename.java
- You have successfully executed the JavaFX program.
Output

Frequently Asked Questions
What is an object in java?
A Java object is an instance of a Java class. Every object has a unique identity, behavior, and state. Fields store an object's state, whereas methods exhibit the object's action.
What is the Scanner class used for in java?
Scanner is a class in java.util package that is used to obtain the input of primitive types such as int, double, and so on, as well as strings.
For what instanceof keyword is used in java?
The keyword instanceof is used to determine whether or not a reference variable contains a specific object reference type.
Conclusion
In this blog, we discussed the JavaFx Pause Transition class, its properties, constructors and their functions, and the implementation of JavaFX Pause Transition.
Cheers, you have reached the end. Hope you liked the blog, and it has added some knowledge to your life about JavaFX pause transition. Please look at these similar topics to learn more: JavaFX Introduction, JavaFX pause transition, JavaFX Box, JavaFX Sphere, JavaFX Lighting, JavaFX HBox, JavaFX VBox.
Refer to our Coding Ninjas Studio Guided Path to learn Data Structures and Algorithms, Competitive Programming, JavaScript, System Design, and even more! You can also check out the mock test series and participate in the contests hosted by Coding Ninjas Studio! But say you're just starting and want to learn about questions posed by tech titans like Amazon, Microsoft, Uber, and so on. In such a case, for placement preparations, you can also look at the problems, interview experiences, and interview bundle.
You should also consider our premium courses to offer your career advantage over others!
Please upvote our blogs if you find them useful and exciting!
Happy Coding!