public final class TranslateTransition extends Transition
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 interval.
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.transition.*;
...
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();
...
Transition
,
Animation
Animation.Status
INDEFINITE
Constructor and Description |
---|
TranslateTransition()
The constructor of
TranslateTransition |
TranslateTransition(Duration duration)
The constructor of
TranslateTransition |
TranslateTransition(Duration duration,
Node node)
The constructor of
TranslateTransition |
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 TranslateTransition(Duration duration, Node node)
TranslateTransition
duration
- The duration of the TranslateTransition
node
- The node
which will be translatedpublic TranslateTransition(Duration duration)
TranslateTransition
duration
- The duration of the TranslateTransition
public TranslateTransition()
TranslateTransition
public 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 setFromX(double value)
public final double getFromX()
public final DoubleProperty fromXProperty()
public final void setFromY(double value)
public final double getFromY()
public final DoubleProperty fromYProperty()
public final void setFromZ(double value)
public final double getFromZ()
public final DoubleProperty fromZProperty()
public final void setToX(double value)
public final double getToX()
public final DoubleProperty toXProperty()
public final void setToY(double value)
public final double getToY()
public final DoubleProperty toYProperty()
public final void setToZ(double value)
public final double getToZ()
public final DoubleProperty toZProperty()
public final void setByX(double value)
public final double getByX()
public final DoubleProperty byXProperty()
public final void setByY(double value)
public final double getByY()
public final DoubleProperty byYProperty()
public final void setByZ(double value)
public final double getByZ()
public final DoubleProperty byZProperty()
public 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 positionCopyright © 2020. All rights reserved.