Top Description Fields Constructors Methods
javafx.animation

public final Class TranslateTransition

extends Transition
Class Inheritance
Imports
javafx.beans.property.DoubleProperty, .ObjectProperty, .ObjectPropertyBase, .SimpleDoubleProperty, .SimpleObjectProperty, javafx.scene.Node, javafx.util.Duration

This Transition creates a move/translate animation that spans its duration. This is done by updating the translateX, translateY and translateZ variables of the node at regular intervals.

It starts from the (fromX, fromY, fromZ) value if provided else uses the node's (translateX, translateY, translateZ) 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.*;

...

    Rectangle rect = new Rectangle (100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(Color.VIOLET);

    TranslateTransition tt = new TranslateTransition(Duration.millis(2000), rect);
    tt.setByX(200f);
    tt.setCycleCount(4f);
    tt.setAutoReverse(true);

    tt.play();

...


Since
JavaFX 2.0
See Also
Transition, Animation

Field Summary

Modifier and TypeField and Description
private DoubleProperty
byX

Specifies the incremented stop X coordinate value, from the start, of this TranslateTransition.

private DoubleProperty
byY

Specifies the incremented stop Y coordinate value, from the start, of this TranslateTransition.

private DoubleProperty
byZ

Specifies the incremented stop Z coordinate value, from the start, of this TranslateTransition.

private Node
private static final double
private static final double
private static final double
private static final Duration
private static final double
private static final double
private static final double
private static final Node
private static final double
private static final double
private static final double
private double
private double
private double
private ObjectProperty<Duration>
duration

The duration of this TranslateTransition.

private static final double
private DoubleProperty
fromX

Specifies the start X coordinate value of this TranslateTransition.

private DoubleProperty
fromY

Specifies the start Y coordinate value of this TranslateTransition.

private DoubleProperty
fromZ

Specifies the start Z coordinate value of this TranslateTransition.

private ObjectProperty<Node>
node

The target node of this TranslateTransition.

private double
private double
private double
private DoubleProperty
toX

Specifies the stop X coordinate value of this TranslateTransition.

private DoubleProperty
toY

Specifies the stop Y coordinate value of this TranslateTransition.

private DoubleProperty
toZ

Specifies the stop Z coordinate value of this TranslateTransition.

Constructor Summary

AccessConstructor and Description
public
TranslateTransition(Duration
The duration of the TranslateTransition
duration
,
Node
The node which will be translated
node
)

The constructor of TranslateTransition

public
TranslateTransition(Duration
The duration of the TranslateTransition
duration
)

The constructor of TranslateTransition

public
TranslateTransition()

The constructor of TranslateTransition

Method Summary

Modifier and TypeMethod and Description
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final ObjectProperty<Duration>
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final double
public final double
public final double
public final Duration
public final double
public final double
public final double
public final Node
private Node
public final double
public final double
public final double
public void
interpolate(double frac)

Implements abstract javafx.animation.Transition.interpolate.

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

public final ObjectProperty<Node>
public final void
setByX(double value)

public final void
setByY(double value)

public final void
setByZ(double value)

public final void
public final void
setFromX(double value)

public final void
setFromY(double value)

public final void
setFromZ(double value)

public final void
setNode(Node value)

public final void
setToX(double value)

public final void
setToY(double value)

public final void
setToZ(double value)

pack-priv boolean
startable(boolean forceSync)

Overrides javafx.animation.Transition.startable.

pack-priv void
sync(boolean forceSync)

Overrides javafx.animation.Transition.sync.

public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
Inherited from javafx.animation.Transition:
doJumpTodoPlayTogetCachedInterpolatorgetInterpolatorgetParentTargetNodeinterpolatorPropertysetInterpolator

Field Detail

byXback to summary
private DoubleProperty byX

Specifies the incremented stop X coordinate value, from the start, of this TranslateTransition.

It is not possible to change byX of a running TranslateTransition. If the value of byX is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

byYback to summary
private DoubleProperty byY

Specifies the incremented stop Y coordinate value, from the start, of this TranslateTransition.

It is not possible to change byY of a running TranslateTransition. If the value of byY is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

byZback to summary
private DoubleProperty byZ

Specifies the incremented stop Z coordinate value, from the start, of this TranslateTransition.

It is not possible to change byZ of a running TranslateTransition. If the value of byZ is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

cachedNodeback to summary
private Node cachedNode
DEFAULT_BY_Xback to summary
private static final double DEFAULT_BY_X
DEFAULT_BY_Yback to summary
private static final double DEFAULT_BY_Y
DEFAULT_BY_Zback to summary
private static final double DEFAULT_BY_Z
DEFAULT_DURATIONback to summary
private static final Duration DEFAULT_DURATION
DEFAULT_FROM_Xback to summary
private static final double DEFAULT_FROM_X
DEFAULT_FROM_Yback to summary
private static final double DEFAULT_FROM_Y
DEFAULT_FROM_Zback to summary
private static final double DEFAULT_FROM_Z
DEFAULT_NODEback to summary
private static final Node DEFAULT_NODE
DEFAULT_TO_Xback to summary
private static final double DEFAULT_TO_X
DEFAULT_TO_Yback to summary
private static final double DEFAULT_TO_Y
DEFAULT_TO_Zback to summary
private static final double DEFAULT_TO_Z
deltaXback to summary
private double deltaX
deltaYback to summary
private double deltaY
deltaZback to summary
private double deltaZ
durationback to summary
private ObjectProperty<Duration> duration

The duration of this TranslateTransition.

It is not possible to change the duration of a running TranslateTransition. If the value of duration is changed for a running TranslateTransition, 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
EPSILONback to summary
private static final double EPSILON

Hides javafx.animation.Animation.EPSILON.

fromXback to summary
private DoubleProperty fromX

Specifies the start X coordinate value of this TranslateTransition.

It is not possible to change fromX of a running TranslateTransition. If the value of fromX is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

Default Value
Double.NaN
fromYback to summary
private DoubleProperty fromY

Specifies the start Y coordinate value of this TranslateTransition.

It is not possible to change fromY of a running TranslateTransition. If the value of fromY is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

Default Value
Double.NaN
fromZback to summary
private DoubleProperty fromZ

Specifies the start Z coordinate value of this TranslateTransition.

It is not possible to change fromZ of a running TranslateTransition. If the value of fromZ is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

Default Value
Double.NaN
nodeback to summary
private ObjectProperty<Node> node

The target node of this TranslateTransition.

It is not possible to change the target node of a running TranslateTransition. If the value of node is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

startXback to summary
private double startX
startYback to summary
private double startY
startZback to summary
private double startZ
toXback to summary
private DoubleProperty toX

Specifies the stop X coordinate value of this TranslateTransition.

It is not possible to change toX of a running TranslateTransition. If the value of toX is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

Default Value
Double.NaN
toYback to summary
private DoubleProperty toY

Specifies the stop Y coordinate value of this TranslateTransition.

It is not possible to change toY of a running TranslateTransition. If the value of toY is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

Default Value
Double.NaN
toZback to summary
private DoubleProperty toZ

Specifies the stop Z coordinate value of this TranslateTransition.

It is not possible to change toZ of a running TranslateTransition. If the value of toZ is changed for a running TranslateTransition, the animation has to be stopped and started again to pick up the new value.

Default Value
Double.NaN

Constructor Detail

TranslateTransitionback to summary
public TranslateTransition(Duration duration, Node node)

The constructor of TranslateTransition

Parameters
duration:Duration

The duration of the TranslateTransition

node:Node

The node which will be translated

TranslateTransitionback to summary
public TranslateTransition(Duration duration)

The constructor of TranslateTransition

Parameters
duration:Duration

The duration of the TranslateTransition

TranslateTransitionback to summary
public TranslateTransition()

The constructor of TranslateTransition

Method Detail

byXPropertyback to summary
public final DoubleProperty byXProperty()
byYPropertyback to summary
public final DoubleProperty byYProperty()
byZPropertyback to summary
public final DoubleProperty byZProperty()
durationPropertyback to summary
public final ObjectProperty<Duration> durationProperty()
fromXPropertyback to summary
public final DoubleProperty fromXProperty()
fromYPropertyback to summary
public final DoubleProperty fromYProperty()
fromZPropertyback to summary
public final DoubleProperty fromZProperty()
getByXback to summary
public final double getByX()
getByYback to summary
public final double getByY()
getByZback to summary
public final double getByZ()
getDurationback to summary
public final Duration getDuration()
getFromXback to summary
public final double getFromX()
getFromYback to summary
public final double getFromY()
getFromZback to summary
public final double getFromZ()
getNodeback to summary
public final Node getNode()
getTargetNodeback to summary
private Node getTargetNode()
getToXback to summary
public final double getToX()
getToYback to summary
public final double getToY()
getToZback to summary
public final double getToZ()
interpolateback to summary
public 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
nodePropertyback to summary
public final ObjectProperty<Node> nodeProperty()
setByXback to summary
public final void setByX(double value)
setByYback to summary
public final void setByY(double value)
setByZback to summary
public final void setByZ(double value)
setDurationback to summary
public final void setDuration(Duration value)
setFromXback to summary
public final void setFromX(double value)
setFromYback to summary
public final void setFromY(double value)
setFromZback to summary
public final void setFromZ(double value)
setNodeback to summary
public final void setNode(Node value)
setToXback to summary
public final void setToX(double value)
setToYback to summary
public final void setToY(double value)
setToZback to summary
public final void setToZ(double value)
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
toXPropertyback to summary
public final DoubleProperty toXProperty()
toYPropertyback to summary
public final DoubleProperty toYProperty()
toZPropertyback to summary
public final DoubleProperty toZProperty()