public final class ScaleTransition extends Transition
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
interval.
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.transition.*;
...
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();
...
Transition,
AnimationAnimation.StatusINDEFINITE| Constructor and Description |
|---|
ScaleTransition()
The constructor of
ScaleTransition |
ScaleTransition(Duration duration)
The constructor of
ScaleTransition |
ScaleTransition(Duration duration,
Node node)
The constructor of
ScaleTransition |
getCachedInterpolator, getInterpolator, getParentTargetNode, interpolatorProperty, setInterpolatorautoReverseProperty, currentRateProperty, currentTimeProperty, cycleCountProperty, cycleDurationProperty, delayProperty, getCuePoints, getCurrentRate, getCurrentTime, getCycleCount, getCycleDuration, getDelay, getOnFinished, getRate, getStatus, getTargetFramerate, getTotalDuration, isAutoReverse, jumpTo, jumpTo, onFinishedProperty, pause, play, playFrom, playFrom, playFromStart, rateProperty, setAutoReverse, setCycleCount, setCycleDuration, setDelay, setOnFinished, setRate, setStatus, statusProperty, stop, totalDurationPropertypublic ScaleTransition(Duration duration, Node node)
ScaleTransitionduration - The duration of the ScaleTransitionnode - The node which will be scaledpublic ScaleTransition(Duration duration)
ScaleTransitionduration - The duration of the ScaleTransitionpublic ScaleTransition()
ScaleTransitionpublic final void setNode(Node value)
public final Node getNode()
public final ObjectProperty<Node> nodeProperty()
public final void setDuration(Duration value)
public final Duration getDuration()
public final ObjectProperty<Duration> durationProperty()
public final void setFromX(double value)
public final double getFromX()
public final DoubleProperty fromXProperty()
public final void setFromY(double value)
public final double getFromY()
public final DoubleProperty fromYProperty()
public final void setFromZ(double value)
public final double getFromZ()
public final DoubleProperty fromZProperty()
public final void setToX(double value)
public final double getToX()
public final DoubleProperty toXProperty()
public final void setToY(double value)
public final double getToY()
public final DoubleProperty toYProperty()
public final void setToZ(double value)
public final double getToZ()
public final DoubleProperty toZProperty()
public final void setByX(double value)
public final double getByX()
public final DoubleProperty byXProperty()
public final void setByY(double value)
public final double getByY()
public final DoubleProperty byYProperty()
public final void setByZ(double value)
public final double getByZ()
public final DoubleProperty byZProperty()
public void interpolate(double frac)
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.interpolate in class Transitionfrac - The relative positionCopyright © 2025. All rights reserved.