APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.animation

public final Class FillTransition

extends Transition
Class Inheritance
Imports
javafx.beans.property.ObjectProperty, .ObjectPropertyBase, .SimpleObjectProperty, javafx.scene.Node, javafx.scene.paint.Color, javafx.scene.shape.Shape, javafx.util.Duration

This 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 javafx.scene.paint.Color in this case).

It stops at the toValue value.

Code Segment Example:


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

...

    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();

...


Since
JavaFX 2.0
See Also
Transition, Animation

Field Summary

Modifier and TypeField and Description
private Shape
private static final Duration
private static final Color
private static final Shape
private static final Color
private ObjectProperty<Duration>
duration

The duration of this FillTransition.

private Color
private ObjectProperty<Color>
fromValue

Specifies the start color value for this FillTransition.

private ObjectProperty<Shape>
shape

The target shape of this FillTransition.

private Color
private ObjectProperty<Color>
toValue

Specifies the stop color value for this FillTransition.

Constructor Summary

AccessConstructor and Description
public
FillTransition(Duration
The duration of the FillTransition
duration
,
Shape
The shape which filling will be animated
shape
,
Color
The start value of the color-animation
fromValue
,
Color
The end value of the color-animation
toValue
)

The constructor of FillTransition

public
FillTransition(Duration
The duration of the FillTransition
duration
,
Color
The start value of the color-animation
fromValue
,
Color
The end value of the color-animation
toValue
)

The constructor of FillTransition

public
FillTransition(Duration
The duration of the FillTransition
duration
,
Shape
The shape which filling will be animated
shape
)

The constructor of FillTransition

public
FillTransition(Duration
The duration of the FadeTransition
duration
)

The constructor of FillTransition

public
FillTransition()

The constructor of FillTransition

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Duration>
public final ObjectProperty<Color>
public final Duration
public final Color
public final Shape
private Shape
public final Color
protected void
interpolate(double frac)

Implements abstract javafx.animation.Transition.interpolate.

The method interpolate() has to be provided by implementations of Transition.

public final void
public final void
public final void
setShape(Shape value)

public final void
public final ObjectProperty<Shape>
pack-priv boolean
startable(boolean forceSync)

Overrides javafx.animation.Transition.startable.

pack-priv void
sync(boolean forceSync)

Overrides javafx.animation.Transition.sync.

public final ObjectProperty<Color>
Inherited from javafx.animation.Transition:
doJumpTodoPlayTogetCachedInterpolatorgetInterpolatorgetParentTargetNodeinterpolatorPropertysetInterpolator

Field Detail

cachedShapeback to summary
private Shape cachedShape
DEFAULT_DURATIONback to summary
private static final Duration DEFAULT_DURATION
DEFAULT_FROM_VALUEback to summary
private static final Color DEFAULT_FROM_VALUE
DEFAULT_SHAPEback to summary
private static final Shape DEFAULT_SHAPE
DEFAULT_TO_VALUEback to summary
private static final Color DEFAULT_TO_VALUE
durationback to summary
private ObjectProperty<Duration> duration

The duration of this 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.

Default Value
400ms
endback to summary
private Color end
fromValueback to summary
private ObjectProperty<Color> fromValue

Specifies the start color value for this 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.

Default Value
null
shapeback to summary
private ObjectProperty<Shape> shape

The target shape of this 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.

startback to summary
private Color start
toValueback to summary
private ObjectProperty<Color> toValue

Specifies the stop color value for this 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.

Default Value
null

Constructor Detail

FillTransitionback to summary
public FillTransition(Duration duration, Shape shape, Color fromValue, Color toValue)

The constructor of FillTransition

Parameters
duration:Duration

The duration of the FillTransition

shape:Shape

The shape which filling will be animated

fromValue:Color

The start value of the color-animation

toValue:Color

The end value of the color-animation

FillTransitionback to summary
public FillTransition(Duration duration, Color fromValue, Color toValue)

The constructor of FillTransition

Parameters
duration:Duration

The duration of the FillTransition

fromValue:Color

The start value of the color-animation

toValue:Color

The end value of the color-animation

FillTransitionback to summary
public FillTransition(Duration duration, Shape shape)

The constructor of FillTransition

Parameters
duration:Duration

The duration of the FillTransition

shape:Shape

The shape which filling will be animated

FillTransitionback to summary
public FillTransition(Duration duration)

The constructor of FillTransition

Parameters
duration:Duration

The duration of the FadeTransition

FillTransitionback to summary
public FillTransition()

The constructor of FillTransition

Method Detail

durationPropertyback to summary
public final ObjectProperty<Duration> durationProperty()
fromValuePropertyback to summary
public final ObjectProperty<Color> fromValueProperty()
getDurationback to summary
public final Duration getDuration()
getFromValueback to summary
public final Color getFromValue()
getShapeback to summary
public final Shape getShape()
getTargetShapeback to summary
private Shape getTargetShape()
getToValueback to summary
public final Color getToValue()
interpolateback to summary
protected void interpolate(double frac)

Implements abstract javafx.animation.Transition.interpolate.

Doc from javafx.animation.Transition.interpolate.

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.

Annotations
@Override
setDurationback to summary
public final void setDuration(Duration value)
setFromValueback to summary
public final void setFromValue(Color value)
setShapeback to summary
public final void setShape(Shape value)
setToValueback to summary
public final void setToValue(Color value)
shapePropertyback to summary
public final ObjectProperty<Shape> shapeProperty()
startableback to summary
pack-priv boolean startable(boolean forceSync)

Overrides javafx.animation.Transition.startable.

Annotations
@Override
syncback to summary
pack-priv void sync(boolean forceSync)

Overrides javafx.animation.Transition.sync.

Annotations
@Override
toValuePropertyback to summary
public final ObjectProperty<Color> toValueProperty()