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
,
Animation
Type | Property and Description |
---|---|
ObjectProperty<Duration> |
duration
The duration of this
FillTransition . |
ObjectProperty<Color> |
fromValue
Specifies the start color value for this
FillTransition . |
ObjectProperty<Shape> |
shape
The target shape of this
FillTransition . |
ObjectProperty<Color> |
toValue
Specifies the stop color value for this
FillTransition . |
interpolator
autoReverse, currentRate, currentTime, cycleCount, cycleDuration, delay, onFinished, rate, status, totalDuration
Animation.Status
INDEFINITE
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()
The duration of this
FillTransition . |
ObjectProperty<Color> |
fromValueProperty()
Specifies the start color value for this
FillTransition . |
Duration |
getDuration()
Gets the value of the property duration.
|
Color |
getFromValue()
Gets the value of the property fromValue.
|
Shape |
getShape()
Gets the value of the property shape.
|
Color |
getToValue()
Gets the value of the property toValue.
|
protected void |
interpolate(double frac)
The method
interpolate() has to be provided by implementations of
Transition . |
void |
setDuration(Duration value)
Sets the value of the property duration.
|
void |
setFromValue(Color value)
Sets the value of the property fromValue.
|
void |
setShape(Shape value)
Sets the value of the property shape.
|
void |
setToValue(Color value)
Sets the value of the property toValue.
|
ObjectProperty<Shape> |
shapeProperty()
The target shape of this
FillTransition . |
ObjectProperty<Color> |
toValueProperty()
Specifies the stop color value for this
FillTransition . |
getCachedInterpolator, getInterpolator, getParentTargetNode, interpolatorProperty, setInterpolator
autoReverseProperty, 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, totalDurationProperty
public final ObjectProperty<Shape> shapeProperty
FillTransition
.
It is not possible to change the target shape
of a running
FillTransition
. If the value of shape
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
getShape()
,
setShape(Shape)
public final ObjectProperty<Duration> durationProperty
FillTransition
.
It is not possible to change the duration
of a running
FillTransition
. If the value of duration
is changed for a
running FillTransition
, 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
.
getDuration()
,
setDuration(Duration)
public final ObjectProperty<Color> fromValueProperty
FillTransition
.
It is not possible to change fromValue
of a running
FillTransition
. If the value of fromValue
is changed for
a running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
getFromValue()
,
setFromValue(Color)
public final ObjectProperty<Color> toValueProperty
FillTransition
.
It is not possible to change toValue
of a running
FillTransition
. If the value of toValue
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
getToValue()
,
setToValue(Color)
public FillTransition(Duration duration, Shape shape, Color fromValue, Color toValue)
FillTransition
duration
- The duration of the FillTransition
shape
- 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)
FillTransition
duration
- The duration of the FillTransition
fromValue
- The start value of the color-animationtoValue
- The end value of the color-animationpublic FillTransition(Duration duration, Shape shape)
FillTransition
duration
- The duration of the FillTransition
shape
- The shape
which filling will be animatedpublic FillTransition(Duration duration)
FillTransition
duration
- The duration of the FadeTransition
public FillTransition()
FillTransition
public final void setShape(Shape value)
FillTransition
.
It is not possible to change the target shape
of a running
FillTransition
. If the value of shape
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
public final Shape getShape()
FillTransition
.
It is not possible to change the target shape
of a running
FillTransition
. If the value of shape
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
public final ObjectProperty<Shape> shapeProperty()
FillTransition
.
It is not possible to change the target shape
of a running
FillTransition
. If the value of shape
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
getShape()
,
setShape(Shape)
public final void setDuration(Duration value)
FillTransition
.
It is not possible to change the duration
of a running
FillTransition
. If the value of duration
is changed for a
running FillTransition
, 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
.
public final Duration getDuration()
FillTransition
.
It is not possible to change the duration
of a running
FillTransition
. If the value of duration
is changed for a
running FillTransition
, 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
.
public final ObjectProperty<Duration> durationProperty()
FillTransition
.
It is not possible to change the duration
of a running
FillTransition
. If the value of duration
is changed for a
running FillTransition
, 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
.
getDuration()
,
setDuration(Duration)
public final void setFromValue(Color value)
FillTransition
.
It is not possible to change fromValue
of a running
FillTransition
. If the value of fromValue
is changed for
a running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
public final Color getFromValue()
FillTransition
.
It is not possible to change fromValue
of a running
FillTransition
. If the value of fromValue
is changed for
a running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
public final ObjectProperty<Color> fromValueProperty()
FillTransition
.
It is not possible to change fromValue
of a running
FillTransition
. If the value of fromValue
is changed for
a running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
getFromValue()
,
setFromValue(Color)
public final void setToValue(Color value)
FillTransition
.
It is not possible to change toValue
of a running
FillTransition
. If the value of toValue
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
public final Color getToValue()
FillTransition
.
It is not possible to change toValue
of a running
FillTransition
. If the value of toValue
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
public final ObjectProperty<Color> toValueProperty()
FillTransition
.
It is not possible to change toValue
of a running
FillTransition
. If the value of toValue
is changed for a
running FillTransition
, the animation has to be stopped and
started again to pick up the new value.
null
getToValue()
,
setToValue(Color)
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 Transition
frac
- The relative positionSubmit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.