Introduction
To generate the scale transition in the JavaFX application, we must apply scale transition to any specific shape. It is capable of scaling the form along all three axes. The javafx.animation.ScaleTransition class contains all the necessary methods for this purpose.
Let us understand this with the help of examples.
JavaFX Scale Transition
This transition animates the scaling of the node by the provided factor during the specified period in any or all of the three directions X, Y, and Z.
ScaleTransition in JavaFX is represented by the class javafx.animation.
ScaleTransition. To produce an acceptable scale transition, we must instantiate this class.
Properties
The following table describes the class's attributes and associated setter methods.

Constructors
The class contains three constructors.
-
public TranslateTransition(): This generates a new instance of TranslateTransition with the default parameters.
-
public TranslateTransition(Duration duration): creates a new instance of TranslateTransition for the duration provided.
- public TranslateTransition(Duration duration, Node node): returns a new instance of Translate Transition with the given duration and node.
Example
In the following example, we construct a circle that translates 500 degrees in the X-direction.
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.Circle;
import javafx.stage.Stage;
import javafx.util.Duration;
public
class NewFXMain extends Application
{
@Override public void start(Stage primaryStage) throws Exception
{
Circle cir = new Circle(50, 100, 50);
cir.setFill(Color.RED);
cir.setStroke(Color.BLACK);
TranslateTransition translate = new TranslateTransition();
translate.setByX(500);
translate.setDuration(Duration.millis(1000));
translate.setCycleCount(500);
translate.setAutoReverse(true);
translate.setNode(cir);
translate.play();
Group root = new Group();
root.getChildren().addAll(cir);
Scene scene = new Scene(root, 500, 200, Color.WHEAT);
primaryStage.setScene(scene);
primaryStage.setTitle("JavaFX Scale Transition example");
primaryStage.show();
}
public
static void main(String[] args)
{
launch(args);
}
}Output:
It can be seen through the images below that the circle translates in the X direction from left to right.








