public final class FadeTransition extends Transition
Transition creates a fade effect animation that spans its
duration. This is done by updating the opacity variable of
the node at regular interval.
It starts from the fromValue if provided else uses the node's
opacity value.
It stops at the toValue value if provided else it will use start
value plus byValue.
The toValue takes precedence if both toValue and
byValue 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);
FadeTransition ft = new FadeTransition(Duration.millis(3000), rect);
ft.setFromValue(1.0);
ft.setToValue(0.3);
ft.setCycleCount(4);
ft.setAutoReverse(true);
ft.play();
...
Transition,
AnimationAnimation.StatusINDEFINITE| Constructor and Description |
|---|
FadeTransition()
The constructor of
FadeTransition |
FadeTransition(Duration duration)
The constructor of
FadeTransition |
FadeTransition(Duration duration,
Node node)
The constructor of
FadeTransition |
| Modifier and Type | Method and Description |
|---|---|
DoubleProperty |
byValueProperty() |
ObjectProperty<Duration> |
durationProperty() |
DoubleProperty |
fromValueProperty() |
double |
getByValue() |
Duration |
getDuration() |
double |
getFromValue() |
Node |
getNode() |
double |
getToValue() |
protected void |
interpolate(double frac)
The method
interpolate() has to be provided by implementations of
Transition. |
ObjectProperty<Node> |
nodeProperty() |
void |
setByValue(double value) |
void |
setDuration(Duration value) |
void |
setFromValue(double value) |
void |
setNode(Node value) |
void |
setToValue(double value) |
DoubleProperty |
toValueProperty() |
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 FadeTransition(Duration duration, Node node)
FadeTransitionduration - The duration of the FadeTransitionnode - The node which opacity will be animatedpublic FadeTransition(Duration duration)
FadeTransitionduration - The duration of the FadeTransitionpublic FadeTransition()
FadeTransitionpublic 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 setFromValue(double value)
public final double getFromValue()
public final DoubleProperty fromValueProperty()
public final void setToValue(double value)
public final double getToValue()
public final DoubleProperty toValueProperty()
public final void setByValue(double value)
public final double getByValue()
public final DoubleProperty byValueProperty()
protected 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.