Transition based animations, such as PathTransition and
RotateTransition.
This class offers a simple framework to define animation. It provides all the
basic functionality defined in Animation. Transition requires
the implementation of a method interpolate(double) which is the
called in each frame, while the Transition is running.
In addition, an extending class needs to set the duration of a single cycle
with Animation#setCycleDuration(javafx.. This duration
is usually set by the user via a duration property (as in
duration) for example. But it can also be calculated
by the extending class as is done in ParallelTransition and
FadeTransition.
Below is a simple example. It creates a small animation that updates the
text property of a javafx. node. It starts
with an empty String and adds gradually letter by letter until the
full String was set when the animation finishes.
final String content = "Lorem ipsum";
final Text text = new Text(10, 20, "");
final Animation animation = new Transition() {
{
setCycleDuration(Duration.millis(2000));
}
protected void interpolate(double frac) {
final int length = content.length();
final int n = Math.round(length * (float) frac);
text.setText(content.substring(0, n));
}
};
animation.play();
Animation
| Modifier and Type | Field and Description |
|---|---|
| private Interpolator | |
| private static final Interpolator | |
| private ObjectProperty | interpolator
Controls the timing for acceleration and deceleration at each
|
| Access | Constructor and Description |
|---|---|
| public | Transition(double
The custom target frame rate for this targetFramerate)TransitionThe constructor of |
| public | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private double | |
| pack-priv void | doJumpTo(long currentTicks, long cycleTicks, boolean forceJump)
Implements abstract javafx.
|
| pack-priv void | doPlayTo(long currentTicks, long cycleTicks)
Implements abstract javafx.
|
| protected Interpolator | Returns: theInterpolator that was set when this
Transition was startedReturns the |
| public final Interpolator | |
| protected Node | Returns: the targetNodeReturns the first non- |
| protected abstract void | interpolate(double
The relative position frac)The method |
| public final ObjectProperty | |
| public final void | |
| pack-priv boolean | |
| pack-priv void |
| cachedInterpolator | back to summary |
|---|---|
| private Interpolator cachedInterpolator | |
| DEFAULT_INTERPOLATOR | back to summary |
|---|---|
| private static final Interpolator DEFAULT_INTERPOLATOR | |
| interpolator | back to summary |
|---|---|
| private ObjectProperty<Interpolator> interpolator Controls the timing for acceleration and deceleration at each
This may only be changed prior to starting the transition or after the
transition has ended. If the value of
Default interpolator is set to
| |
| Transition | back to summary |
|---|---|
| public Transition(double targetFramerate) The constructor of
| |
| Transition | back to summary |
|---|---|
| public Transition() The constructor of | |
| Transition | back to summary |
|---|---|
| pack-priv Transition(AbstractPrimaryTimer timer) | |
| calculateFraction | back to summary |
|---|---|
| private double calculateFraction(long currentTicks, long cycleTicks) | |
| doJumpTo | back to summary |
|---|---|
| pack-priv void doJumpTo(long currentTicks, long cycleTicks, boolean forceJump) Implements abstract javafx.
| |
| doPlayTo | back to summary |
|---|---|
| pack-priv void doPlayTo(long currentTicks, long cycleTicks) Implements abstract javafx.
| |
| getCachedInterpolator | back to summary |
|---|---|
| protected Interpolator getCachedInterpolator() Returns the
| |
| getInterpolator | back to summary |
|---|---|
| public final Interpolator getInterpolator() | |
| getParentTargetNode | back to summary |
|---|---|
| protected Node getParentTargetNode() Returns the first non-
A parent animation is one that can have child animations. Examples are
Note that if this
| |
| interpolate | back to summary |
|---|---|
| protected abstract void interpolate(double frac) The method
| |
| interpolatorProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| setInterpolator | back to summary |
|---|---|
| public final void setInterpolator(Interpolator value) | |
| startable | back to summary |
|---|---|
| pack-priv boolean startable(boolean forceSync) Overrides javafx.
| |
| sync | back to summary |
|---|---|
| pack-priv void sync(boolean forceSync) Overrides javafx.
| |