Home » javafx Fade Transition

javafx Fade Transition

by Online Tutorials Library

JavaFX Fade Transition

It animates the opacity of the node so that the fill color of the node becomes dull. This can be done by keep decreasing the opacity of the fill color over a specified duration in order to reach a target opacity value.

In JavaFX, the class javafx.animation.FadeTransition represents FadeTransition. We need to instantiate this class in order to create the appropriate Fade Transition.

Properties

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

Property Description Setter Methods
byValue It is a double type property. It represents the incremented stop opacity value of the Fade transition. setByValue(double property)
Duration This is an object type property of the class Duration. It represent the duration of this fade transition. setDuration(Duration duration)
fromValue This is a double type property. It represents the start opacity for the fade transition. setFromValue(double value)
node This is an object type property of the class Node. This represents the node onto which, the transition is to be applied. setNode(Node node)
toValue This is a double type property. This represents the stop value of the opacity for the fade transition. setToValue(double value)

Constructors

The class contains three Constructors.

  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, the opacity of the color of the circle keeps decreasing from the 10 to 0.1.

Output:

JavaFX Fade Transition

You may also like