Class ScaleTransition


public final class ScaleTransition extends Transition
This Transition creates a scale animation that spans its duration. This is done by updating the scaleX, scaleY and scaleZ variables of the node at regular intervals.

It starts from the (fromX, fromY, fromZ) value if provided else uses the node's (scaleX, scaleY, scaleZ) value.

It stops at the (toX, toY, toZ) value if provided else it will use start value plus (byX, byY, byZ) value.

The (toX, toY, toZ) value takes precedence if both ( toX, toY, toZ) and (byX, byY, byZ) values are specified.

Code Segment Example:

 
 import javafx.scene.shape.*;
 import javafx.animation.*;

 ...

     Rectangle rect = new Rectangle (100, 40, 100, 100);
     rect.setArcHeight(50);
     rect.setArcWidth(50);
     rect.setFill(Color.VIOLET);

     ScaleTransition st = new ScaleTransition(Duration.millis(2000), rect);
     st.setByX(1.5f);
     st.setByY(1.5f);
     st.setCycleCount(4f);
     st.setAutoReverse(true);

     st.play();

 ...

 
 
Since:
JavaFX 2.0
See Also:
  • Property Details Link icon

    • node Link icon

      public final ObjectProperty<Node> nodeProperty
      The target node of this ScaleTransition.

      It is not possible to change the target node of a running ScaleTransition. If the value of node is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      See Also:
    • duration Link icon

      public final ObjectProperty<Duration> durationProperty
      The duration of this ScaleTransition.

      It is not possible to change the duration of a running ScaleTransition. If the value of duration is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Note: While the unit of duration is a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower than Duration.ZERO will result in IllegalArgumentException.

      Default value:
      400ms
      See Also:
    • fromX Link icon

      public final DoubleProperty fromXProperty
      Specifies the start X scale value of this ScaleTransition.

      It is not possible to change fromX of a running ScaleTransition. If the value of fromX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      See Also:
    • fromY Link icon

      public final DoubleProperty fromYProperty
      Specifies the start Y scale value of this ScaleTransition.

      It is not possible to change fromY of a running ScaleTransition. If the value of fromY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      See Also:
    • fromZ Link icon

      public final DoubleProperty fromZProperty
      Specifies the start Z scale value of this ScaleTransition.

      It is not possible to change fromZ of a running ScaleTransition. If the value of fromZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      See Also:
    • toX Link icon

      public final DoubleProperty toXProperty
      Specifies the stop X scale value of this ScaleTransition.

      It is not possible to change toX of a running ScaleTransition. If the value of toX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      See Also:
    • toY Link icon

      public final DoubleProperty toYProperty
      The stop Y scale value of this ScaleTransition.

      It is not possible to change toY of a running ScaleTransition. If the value of toY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      See Also:
    • toZ Link icon

      public final DoubleProperty toZProperty
      The stop Z scale value of this ScaleTransition.

      It is not possible to change toZ of a running ScaleTransition. If the value of toZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      See Also:
    • byX Link icon

      public final DoubleProperty byXProperty
      Specifies the incremented stop X scale value, from the start, of this ScaleTransition.

      It is not possible to change byX of a running ScaleTransition. If the value of byX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      See Also:
    • byY Link icon

      public final DoubleProperty byYProperty
      Specifies the incremented stop Y scale value, from the start, of this ScaleTransition.

      It is not possible to change byY of a running ScaleTransition. If the value of byY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      See Also:
    • byZ Link icon

      public final DoubleProperty byZProperty
      Specifies the incremented stop Z scale value, from the start, of this ScaleTransition.

      It is not possible to change byZ of a running ScaleTransition. If the value of byZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      See Also:
  • Constructor Details Link icon

    • ScaleTransition Link icon

      public ScaleTransition(Duration duration, Node node)
      The constructor of ScaleTransition
      Parameters:
      duration - The duration of the ScaleTransition
      node - The node which will be scaled
    • ScaleTransition Link icon

      public ScaleTransition(Duration duration)
      The constructor of ScaleTransition
      Parameters:
      duration - The duration of the ScaleTransition
    • ScaleTransition Link icon

      public ScaleTransition()
      The constructor of ScaleTransition
  • Method Details Link icon

    • setNode Link icon

      public final void setNode(Node value)
      Sets the value of the node property.
      Property description:
      The target node of this ScaleTransition.

      It is not possible to change the target node of a running ScaleTransition. If the value of node is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Parameters:
      value - the value for the node property
      See Also:
    • getNode Link icon

      public final Node getNode()
      Gets the value of the node property.
      Property description:
      The target node of this ScaleTransition.

      It is not possible to change the target node of a running ScaleTransition. If the value of node is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the value of the node property
      See Also:
    • nodeProperty Link icon

      public final ObjectProperty<Node> nodeProperty()
      The target node of this ScaleTransition.

      It is not possible to change the target node of a running ScaleTransition. If the value of node is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the node property
      See Also:
    • setDuration Link icon

      public final void setDuration(Duration value)
      Sets the value of the duration property.
      Property description:
      The duration of this ScaleTransition.

      It is not possible to change the duration of a running ScaleTransition. If the value of duration is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Note: While the unit of duration is a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower than Duration.ZERO will result in IllegalArgumentException.

      Default value:
      400ms
      Parameters:
      value - the value for the duration property
      See Also:
    • getDuration Link icon

      public final Duration getDuration()
      Gets the value of the duration property.
      Property description:
      The duration of this ScaleTransition.

      It is not possible to change the duration of a running ScaleTransition. If the value of duration is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Note: While the unit of duration is a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower than Duration.ZERO will result in IllegalArgumentException.

      Default value:
      400ms
      Returns:
      the value of the duration property
      See Also:
    • durationProperty Link icon

      public final ObjectProperty<Duration> durationProperty()
      The duration of this ScaleTransition.

      It is not possible to change the duration of a running ScaleTransition. If the value of duration is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Note: While the unit of duration is a millisecond, the granularity depends on the underlying operating system and will in general be larger. For example animations on desktop systems usually run with a maximum of 60fps which gives a granularity of ~17 ms. Setting duration to value lower than Duration.ZERO will result in IllegalArgumentException.

      Default value:
      400ms
      Returns:
      the duration property
      See Also:
    • setFromX Link icon

      public final void setFromX(double value)
      Sets the value of the fromX property.
      Property description:
      Specifies the start X scale value of this ScaleTransition.

      It is not possible to change fromX of a running ScaleTransition. If the value of fromX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Parameters:
      value - the value for the fromX property
      See Also:
    • getFromX Link icon

      public final double getFromX()
      Gets the value of the fromX property.
      Property description:
      Specifies the start X scale value of this ScaleTransition.

      It is not possible to change fromX of a running ScaleTransition. If the value of fromX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the value of the fromX property
      See Also:
    • fromXProperty Link icon

      public final DoubleProperty fromXProperty()
      Specifies the start X scale value of this ScaleTransition.

      It is not possible to change fromX of a running ScaleTransition. If the value of fromX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the fromX property
      See Also:
    • setFromY Link icon

      public final void setFromY(double value)
      Sets the value of the fromY property.
      Property description:
      Specifies the start Y scale value of this ScaleTransition.

      It is not possible to change fromY of a running ScaleTransition. If the value of fromY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Parameters:
      value - the value for the fromY property
      See Also:
    • getFromY Link icon

      public final double getFromY()
      Gets the value of the fromY property.
      Property description:
      Specifies the start Y scale value of this ScaleTransition.

      It is not possible to change fromY of a running ScaleTransition. If the value of fromY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the value of the fromY property
      See Also:
    • fromYProperty Link icon

      public final DoubleProperty fromYProperty()
      Specifies the start Y scale value of this ScaleTransition.

      It is not possible to change fromY of a running ScaleTransition. If the value of fromY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the fromY property
      See Also:
    • setFromZ Link icon

      public final void setFromZ(double value)
      Sets the value of the fromZ property.
      Property description:
      Specifies the start Z scale value of this ScaleTransition.

      It is not possible to change fromZ of a running ScaleTransition. If the value of fromZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Parameters:
      value - the value for the fromZ property
      See Also:
    • getFromZ Link icon

      public final double getFromZ()
      Gets the value of the fromZ property.
      Property description:
      Specifies the start Z scale value of this ScaleTransition.

      It is not possible to change fromZ of a running ScaleTransition. If the value of fromZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the value of the fromZ property
      See Also:
    • fromZProperty Link icon

      public final DoubleProperty fromZProperty()
      Specifies the start Z scale value of this ScaleTransition.

      It is not possible to change fromZ of a running ScaleTransition. If the value of fromZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the fromZ property
      See Also:
    • setToX Link icon

      public final void setToX(double value)
      Sets the value of the toX property.
      Property description:
      Specifies the stop X scale value of this ScaleTransition.

      It is not possible to change toX of a running ScaleTransition. If the value of toX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Parameters:
      value - the value for the toX property
      See Also:
    • getToX Link icon

      public final double getToX()
      Gets the value of the toX property.
      Property description:
      Specifies the stop X scale value of this ScaleTransition.

      It is not possible to change toX of a running ScaleTransition. If the value of toX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the value of the toX property
      See Also:
    • toXProperty Link icon

      public final DoubleProperty toXProperty()
      Specifies the stop X scale value of this ScaleTransition.

      It is not possible to change toX of a running ScaleTransition. If the value of toX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the toX property
      See Also:
    • setToY Link icon

      public final void setToY(double value)
      Sets the value of the toY property.
      Property description:
      The stop Y scale value of this ScaleTransition.

      It is not possible to change toY of a running ScaleTransition. If the value of toY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Parameters:
      value - the value for the toY property
      See Also:
    • getToY Link icon

      public final double getToY()
      Gets the value of the toY property.
      Property description:
      The stop Y scale value of this ScaleTransition.

      It is not possible to change toY of a running ScaleTransition. If the value of toY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the value of the toY property
      See Also:
    • toYProperty Link icon

      public final DoubleProperty toYProperty()
      The stop Y scale value of this ScaleTransition.

      It is not possible to change toY of a running ScaleTransition. If the value of toY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the toY property
      See Also:
    • setToZ Link icon

      public final void setToZ(double value)
      Sets the value of the toZ property.
      Property description:
      The stop Z scale value of this ScaleTransition.

      It is not possible to change toZ of a running ScaleTransition. If the value of toZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Parameters:
      value - the value for the toZ property
      See Also:
    • getToZ Link icon

      public final double getToZ()
      Gets the value of the toZ property.
      Property description:
      The stop Z scale value of this ScaleTransition.

      It is not possible to change toZ of a running ScaleTransition. If the value of toZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the value of the toZ property
      See Also:
    • toZProperty Link icon

      public final DoubleProperty toZProperty()
      The stop Z scale value of this ScaleTransition.

      It is not possible to change toZ of a running ScaleTransition. If the value of toZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Default value:
      Double.NaN
      Returns:
      the toZ property
      See Also:
    • setByX Link icon

      public final void setByX(double value)
      Sets the value of the byX property.
      Property description:
      Specifies the incremented stop X scale value, from the start, of this ScaleTransition.

      It is not possible to change byX of a running ScaleTransition. If the value of byX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Parameters:
      value - the value for the byX property
      See Also:
    • getByX Link icon

      public final double getByX()
      Gets the value of the byX property.
      Property description:
      Specifies the incremented stop X scale value, from the start, of this ScaleTransition.

      It is not possible to change byX of a running ScaleTransition. If the value of byX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the value of the byX property
      See Also:
    • byXProperty Link icon

      public final DoubleProperty byXProperty()
      Specifies the incremented stop X scale value, from the start, of this ScaleTransition.

      It is not possible to change byX of a running ScaleTransition. If the value of byX is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the byX property
      See Also:
    • setByY Link icon

      public final void setByY(double value)
      Sets the value of the byY property.
      Property description:
      Specifies the incremented stop Y scale value, from the start, of this ScaleTransition.

      It is not possible to change byY of a running ScaleTransition. If the value of byY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Parameters:
      value - the value for the byY property
      See Also:
    • getByY Link icon

      public final double getByY()
      Gets the value of the byY property.
      Property description:
      Specifies the incremented stop Y scale value, from the start, of this ScaleTransition.

      It is not possible to change byY of a running ScaleTransition. If the value of byY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the value of the byY property
      See Also:
    • byYProperty Link icon

      public final DoubleProperty byYProperty()
      Specifies the incremented stop Y scale value, from the start, of this ScaleTransition.

      It is not possible to change byY of a running ScaleTransition. If the value of byY is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the byY property
      See Also:
    • setByZ Link icon

      public final void setByZ(double value)
      Sets the value of the byZ property.
      Property description:
      Specifies the incremented stop Z scale value, from the start, of this ScaleTransition.

      It is not possible to change byZ of a running ScaleTransition. If the value of byZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Parameters:
      value - the value for the byZ property
      See Also:
    • getByZ Link icon

      public final double getByZ()
      Gets the value of the byZ property.
      Property description:
      Specifies the incremented stop Z scale value, from the start, of this ScaleTransition.

      It is not possible to change byZ of a running ScaleTransition. If the value of byZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the value of the byZ property
      See Also:
    • byZProperty Link icon

      public final DoubleProperty byZProperty()
      Specifies the incremented stop Z scale value, from the start, of this ScaleTransition.

      It is not possible to change byZ of a running ScaleTransition. If the value of byZ is changed for a running ScaleTransition, the animation has to be stopped and started again to pick up the new value.

      Returns:
      the byZ property
      See Also:
    • interpolate Link icon

      public void interpolate(double frac)
      The method interpolate() has to be provided by implementations of Transition. While a Transition is running, this method is called in every frame. The parameter defines the current position with the animation. At the start, the fraction will be 0.0 and at the end it will be 1.0. How the parameter increases, depends on the interpolator, e.g. if the interpolator is Interpolator.LINEAR, the fraction will increase linear. This method must not be called by the user directly.
      Specified by:
      interpolate in class Transition
      Parameters:
      frac - The relative position