Home » javafx Scale Transition

javafx Scale Transition

by Online Tutorials Library

JavaFX Scale Transition

This transition animates the scaling of the node over the specified duration by the specified factor in any or all of the three directions X, Y, and Z.

In JavaFX, ScaleTransition is represented by the class javafx.animation.ScaleTransition. We need to instantiate this class in order to generate an appropriate scale transition.

Properties

The properties of the class along with their setter methods are described in the following table.

Property Description Setter Methods
byX This is a double type property. It represents the incremented stop X factor value. setByX(double value)
byY This is a double type property. It represents the incremented stop Y factor value. setByY(double value)
byZ This is a double type property. It represents the incremented stop Z factor value. setByZ(double value)
duration This is an object type property of the class Duration . It represents the duration of scale transition. setDuration(Duration value)
fromX This is a double type property. It represents the start X value of ScaleTransition. setFromX(double value)
fromY This is a double type property. It represents the start Y value of ScaleTransition. setFromY(double value)
fromZ This is a double type property. It represents the start Z value of ScaleTransition. setFromZ(double value)
node This is an object type property of the class Node. It represents onto which, the scale transition is applied. setNode(Node node)
toX This is a double type property. It represents the stop X scale value of the scale transition. setToX(double value)
toY This is a double type property. It represents the stop Y scale value of the scale transition. setToY(double value)
toZ This is a double type property. It represents the stop Z scale value of the scale transition. setToZ(double value)

Constructors

There are three constructors in the class.

  1. public TranslateTransition() : creates the new instance of TranslateTransition with the default parameters.
  2. public TranslateTransition(Duration duration) : creates the new instance of TranslateTransition with the specified duration.
  3. public TranslateTransition(Duration duration, Node node) : creates the new instance of Translate Transition with the specified duration and node.

Example

In the following example, we have made a circle translating itself by 400 in the X direction.

Output:

JavaFX Scale Transition

You may also like