public final class FillTransition extends Transition
Transition creates an animation, that changes the filling of a
shape over a duration. This is done by updating the fill
variable of the shape at regular intervals.
It starts from the fromValue if provided else uses the shape
's fill value. (The stroke value has to be a
Color in this case).
It stops at the toValue value.
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);
FillTransition ft = new FillTransition(Duration.millis(3000), rect, Color.RED, Color.BLUE);
ft.setCycleCount(4);
ft.setAutoReverse(true);
ft.play();
...
Transition,
AnimationAnimation.StatusINDEFINITE| Constructor and Description |
|---|
FillTransition()
The constructor of
FillTransition |
FillTransition(Duration duration)
The constructor of
FillTransition |
FillTransition(Duration duration,
Color fromValue,
Color toValue)
The constructor of
FillTransition |
FillTransition(Duration duration,
Shape shape)
The constructor of
FillTransition |
FillTransition(Duration duration,
Shape shape,
Color fromValue,
Color toValue)
The constructor of
FillTransition |
| Modifier and Type | Method and Description |
|---|---|
ObjectProperty<Duration> |
durationProperty() |
ObjectProperty<Color> |
fromValueProperty() |
Duration |
getDuration() |
Color |
getFromValue() |
Shape |
getShape() |
Color |
getToValue() |
protected void |
interpolate(double frac)
The method
interpolate() has to be provided by implementations of
Transition. |
void |
setDuration(Duration value) |
void |
setFromValue(Color value) |
void |
setShape(Shape value) |
void |
setToValue(Color value) |
ObjectProperty<Shape> |
shapeProperty() |
ObjectProperty<Color> |
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 FillTransition(Duration duration, Shape shape, Color fromValue, Color toValue)
FillTransitionduration - The duration of the FillTransitionshape - The shape which filling will be animatedfromValue - The start value of the color-animationtoValue - The end value of the color-animationpublic FillTransition(Duration duration, Color fromValue, Color toValue)
FillTransitionduration - The duration of the FillTransitionfromValue - The start value of the color-animationtoValue - The end value of the color-animationpublic FillTransition(Duration duration, Shape shape)
FillTransitionduration - The duration of the FillTransitionshape - The shape which filling will be animatedpublic FillTransition(Duration duration)
FillTransitionduration - The duration of the FadeTransitionpublic FillTransition()
FillTransitionpublic final void setShape(Shape value)
public final Shape getShape()
public final ObjectProperty<Shape> shapeProperty()
public final void setDuration(Duration value)
public final Duration getDuration()
public final ObjectProperty<Duration> durationProperty()
public final void setFromValue(Color value)
public final Color getFromValue()
public final ObjectProperty<Color> fromValueProperty()
public final void setToValue(Color value)
public final Color getToValue()
public final ObjectProperty<Color> toValueProperty()
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.