public final class ScaleTransition extends Transition
Transition creates a scale animation that spans its
duration. This is done by updating the scaleX,
scaleY and scaleZ variables of the node at regular
interval.
It starts from the (fromX, fromY, fromZ) value if
provided else uses the node's (scaleX, scaleY,
scaleZ) 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);
ScaleTransition st = new ScaleTransition(Duration.millis(2000), rect);
st.setByX(1.5f);
st.setByY(1.5f);
st.setCycleCount(4f);
st.setAutoReverse(true);
st.play();
...
Transition,
AnimationAnimation.Status| Modifier and Type | Field and Description |
|---|---|
private DoubleProperty |
byX
Specifies the incremented stop X scale value, from the start, of this
ScaleTransition. |
private DoubleProperty |
byY
Specifies the incremented stop Y scale value, from the start, of this
ScaleTransition. |
private DoubleProperty |
byZ
Specifies the incremented stop Z scale value, from the start, of this
ScaleTransition. |
private Node |
cachedNode |
private static double |
DEFAULT_BY_X |
private static double |
DEFAULT_BY_Y |
private static double |
DEFAULT_BY_Z |
private static Duration |
DEFAULT_DURATION |
private static double |
DEFAULT_FROM_X |
private static double |
DEFAULT_FROM_Y |
private static double |
DEFAULT_FROM_Z |
private static Node |
DEFAULT_NODE |
private static double |
DEFAULT_TO_X |
private static double |
DEFAULT_TO_Y |
private static double |
DEFAULT_TO_Z |
private double |
deltaX |
private double |
deltaY |
private double |
deltaZ |
private ObjectProperty<Duration> |
duration
The duration of this
ScaleTransition. |
private static double |
EPSILON |
private DoubleProperty |
fromX
Specifies the start X scale value of this
ScaleTransition. |
private DoubleProperty |
fromY
Specifies the start Y scale value of this
ScaleTransition. |
private DoubleProperty |
fromZ
Specifies the start Z scale value of this
ScaleTransition. |
private ObjectProperty<Node> |
node
The target node of this
ScaleTransition. |
private double |
startX |
private double |
startY |
private double |
startZ |
private DoubleProperty |
toX
Specifies the stop X scale value of this
ScaleTransition. |
private DoubleProperty |
toY
The stop Y scale value of this
ScaleTransition. |
private DoubleProperty |
toZ
The stop Z scale value of this
ScaleTransition. |
clipEnvelope, INDEFINITE, parent, pulseReceiver| Constructor and Description |
|---|
ScaleTransition()
The constructor of
ScaleTransition |
ScaleTransition(Duration duration)
The constructor of
ScaleTransition |
ScaleTransition(Duration duration,
Node node)
The constructor of
ScaleTransition |
| Modifier and Type | Method and Description |
|---|---|
DoubleProperty |
byXProperty() |
DoubleProperty |
byYProperty() |
DoubleProperty |
byZProperty() |
ObjectProperty<Duration> |
durationProperty() |
DoubleProperty |
fromXProperty() |
DoubleProperty |
fromYProperty() |
DoubleProperty |
fromZProperty() |
double |
getByX() |
double |
getByY() |
double |
getByZ() |
Duration |
getDuration() |
double |
getFromX() |
double |
getFromY() |
double |
getFromZ() |
Node |
getNode() |
private Node |
getTargetNode() |
double |
getToX() |
double |
getToY() |
double |
getToZ() |
(package private) boolean |
impl_startable(boolean forceSync) |
(package private) void |
impl_sync(boolean forceSync) |
void |
interpolate(double frac)
The method
interpolate() has to be provided by implementations of
Transition. |
ObjectProperty<Node> |
nodeProperty() |
void |
setByX(double value) |
void |
setByY(double value) |
void |
setByZ(double value) |
void |
setDuration(Duration value) |
void |
setFromX(double value) |
void |
setFromY(double value) |
void |
setFromZ(double value) |
void |
setNode(Node value) |
void |
setToX(double value) |
void |
setToY(double value) |
void |
setToZ(double value) |
DoubleProperty |
toXProperty() |
DoubleProperty |
toYProperty() |
DoubleProperty |
toZProperty() |
getCachedInterpolator, getInterpolator, getParentTargetNode, impl_jumpTo, impl_playTo, interpolatorProperty, setInterpolatorautoReverseProperty, currentRateProperty, currentTimeProperty, cycleCountProperty, cycleDurationProperty, delayProperty, getCuePoints, getCurrentRate, getCurrentTime, getCycleCount, getCycleDuration, getDelay, getOnFinished, getRate, getStatus, getTargetFramerate, getTotalDuration, impl_finished, impl_pause, impl_resume, impl_setCurrentRate, impl_setCurrentTicks, impl_start, impl_stop, impl_timePulse, isAutoReverse, jumpTo, jumpTo, onFinishedProperty, pause, pauseReceiver, play, playFrom, playFrom, playFromStart, rateProperty, resumeReceiver, setAutoReverse, setCycleCount, setCycleDuration, setDelay, setOnFinished, setRate, setStatus, startReceiver, statusProperty, stop, totalDurationPropertyprivate static final double EPSILON
private double startX
private double startY
private double startZ
private double deltaX
private double deltaY
private double deltaZ
private ObjectProperty<Node> node
ScaleTransition.
It is not possible to change the target node of a running
ScaleTransition. If the value of node is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final Node DEFAULT_NODE
private Node cachedNode
private ObjectProperty<Duration> duration
ScaleTransition.
It is not possible to change the duration of a running
ScaleTransition. If the value of duration is changed for
a running ScaleTransition, 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.
private static final Duration DEFAULT_DURATION
private DoubleProperty fromX
ScaleTransition.
It is not possible to change fromX of a running
ScaleTransition. If the value of fromX is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_FROM_X
private DoubleProperty fromY
ScaleTransition.
It is not possible to change fromY of a running
ScaleTransition. If the value of fromY is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_FROM_Y
private DoubleProperty fromZ
ScaleTransition.
It is not possible to change fromZ of a running
ScaleTransition. If the value of fromZ is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_FROM_Z
private DoubleProperty toX
ScaleTransition.
It is not possible to change toX of a running
ScaleTransition. If the value of toX is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_TO_X
private DoubleProperty toY
ScaleTransition.
It is not possible to change toY of a running
ScaleTransition. If the value of toY is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_TO_Y
private DoubleProperty toZ
ScaleTransition.
It is not possible to change toZ of a running
ScaleTransition. If the value of toZ is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_TO_Z
private DoubleProperty byX
ScaleTransition.
It is not possible to change byX of a running
ScaleTransition. If the value of byX is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_BY_X
private DoubleProperty byY
ScaleTransition.
It is not possible to change byY of a running
ScaleTransition. If the value of byY is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_BY_Y
private DoubleProperty byZ
ScaleTransition.
It is not possible to change byZ of a running
ScaleTransition. If the value of byZ is changed for a
running ScaleTransition, the animation has to be stopped and
started again to pick up the new value.
private static final double DEFAULT_BY_Z
public ScaleTransition(Duration duration, Node node)
ScaleTransitionduration - The duration of the ScaleTransitionnode - The node which will be scaledpublic ScaleTransition(Duration duration)
ScaleTransitionduration - The duration of the ScaleTransitionpublic ScaleTransition()
ScaleTransitionpublic 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 Transitionfrac - The relative positionprivate Node getTargetNode()
boolean impl_startable(boolean forceSync)
impl_startable in class Transitionvoid impl_sync(boolean forceSync)
impl_sync in class Transition