Transition creates a path animation that spans its
duration. The translation along the path is done by updating the
translateX and translateY variables of the node, and
the rotate variable will get updated if orientation is set to
OrientationType.ORTHOGONAL_TO_TANGENT, at regular intervals.
The animated path is defined by the outline of a shape.
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);
Path path = new Path();
path.getElements().add (new MoveTo (0f, 50f));
path.getElements().add (new CubicCurveTo (40f, 10f, 390f, 240f, 1904, 50f));
pathTransition.setDuration(Duration.millis(10000));
pathTransition.setNode(rect);
pathTransition.setPath(path);
pathTransition.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT);
pathTransition.setCycleCount(4f);
pathTransition.setAutoReverse(true);
pathTransition.play();
...
Transition, Animation
| Modifier and Type | Class and Description |
|---|---|
| public static enum | PathTransition.
Specifies the upright orientation of |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private Node | |
| private static final Duration | |
| private static final Node | |
| private static final PathTransition. | |
| private static final Shape | |
| private ObjectProperty | duration
The duration of this |
| private ObjectProperty | node
The target node of this |
| private ObjectProperty | orientation
Specifies the upright orientation of |
| private ObjectProperty | path
The shape on which outline the node should be animated. |
| private final ArrayList | |
| private static final int | |
| private double |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PathTransition(Duration
The duration, Shape duration of this PathTransitionThe path)path of this PathTransitionThe constructor of |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final ObjectProperty | |
| private int | findSegment(int begin, int end, double length)
Returns the index of the first segment having accumulated length
from the path beginning, greater than |
| public final Duration | |
| public final Node | |
| public final PathTransition. | |
| public final Shape | |
| private Node | |
| public void | interpolate(double
The relative position frac)Implements abstract javafx. The method |
| private static double | interpolate(double fromAngle, double toAngle, double ratio)
Interpolates angle according to rate, with correct 0->360 and 360->0 transitions |
| public final ObjectProperty | |
| private static double | |
| public final ObjectProperty | |
| public final ObjectProperty | |
| private void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| pack-priv boolean | |
| pack-priv void |
| cachedIsNormalRequired | back to summary |
|---|---|
| private boolean cachedIsNormalRequired | |
| cachedNode | back to summary |
|---|---|
| private Node cachedNode | |
| DEFAULT_DURATION | back to summary |
|---|---|
| private static final Duration DEFAULT_DURATION | |
| DEFAULT_NODE | back to summary |
|---|---|
| private static final Node DEFAULT_NODE | |
| DEFAULT_ORIENTATION | back to summary |
|---|---|
| private static final PathTransition. | |
| DEFAULT_PATH | back to summary |
|---|---|
| private static final Shape DEFAULT_PATH | |
| duration | back to summary |
|---|---|
| private ObjectProperty<Duration> duration The duration of this
It is not possible to change the Note While the unit of
| |
| node | back to summary |
|---|---|
| private ObjectProperty<Node> node The target node of this
It is not possible to change the target | |
| orientation | back to summary |
|---|---|
| private ObjectProperty<PathTransition. Specifies the upright orientation of
It is not possible to change the
| |
| path | back to summary |
|---|---|
| private ObjectProperty<Shape> path The shape on which outline the node should be animated.
It is not possible to change the
| |
| segments | back to summary |
|---|---|
| private final ArrayList<PathTransition. | |
| SMOOTH_ZONE | back to summary |
|---|---|
| private static final int SMOOTH_ZONE | |
| totalLength | back to summary |
|---|---|
| private double totalLength | |
| PathTransition | back to summary |
|---|---|
| public PathTransition(Duration duration, Shape path, Node node) The constructor of | |
| PathTransition | back to summary |
|---|---|
| public PathTransition(Duration duration, Shape path) The constructor of | |
| PathTransition | back to summary |
|---|---|
| public PathTransition() The constructor of | |
| durationProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| findSegment | back to summary |
|---|---|
| private int findSegment(int begin, int end, double length) Returns the index of the first segment having accumulated length
from the path beginning, greater than | |
| getDuration | back to summary |
|---|---|
| public final Duration getDuration() | |
| getNode | back to summary |
|---|---|
| public final Node getNode() | |
| getOrientation | back to summary |
|---|---|
| public final PathTransition. | |
| getPath | back to summary |
|---|---|
| public final Shape getPath() | |
| getTargetNode | back to summary |
|---|---|
| private Node getTargetNode() | |
| interpolate | back to summary |
|---|---|
| public void interpolate(double frac) Implements abstract javafx. Doc from javafx. The method
| |
| interpolate | back to summary |
|---|---|
| private static double interpolate(double fromAngle, double toAngle, double ratio) Interpolates angle according to rate, with correct 0->360 and 360->0 transitions | |
| nodeProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| normalize | back to summary |
|---|---|
| private static double normalize(double angle) Converts angle to range 0-360 | |
| orientationProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| pathProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| recomputeSegments | back to summary |
|---|---|
| private void recomputeSegments() | |
| setDuration | back to summary |
|---|---|
| public final void setDuration(Duration value) | |
| setNode | back to summary |
|---|---|
| public final void setNode(Node value) | |
| setOrientation | back to summary |
|---|---|
| public final void setOrientation(PathTransition. | |
| setPath | back to summary |
|---|---|
| public final void setPath(Shape 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.
| |
node along the path.
| Modifier and Type | Field and Description |
|---|---|
| public static final PathTransition. | NONE
The targeted |
| public static final PathTransition. | ORTHOGONAL_TO_TANGENT
The targeted node's rotation matrix is set to keep |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static PathTransition. | |
| public static PathTransition. |
| NONE | back to summary |
|---|---|
| public static final PathTransition. The targeted | |
| ORTHOGONAL_TO_TANGENT | back to summary |
|---|---|
| public static final PathTransition. The targeted node's rotation matrix is set to keep | |
| OrientationType | back to summary |
|---|---|
| private OrientationType() | |
| valueOf | back to summary |
|---|---|
| public static PathTransition. | |
| values | back to summary |
|---|---|
| public static PathTransition. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv double | |
| pack-priv boolean | |
| pack-priv double | |
| pack-priv PathTransition. | |
| pack-priv PathTransition. | |
| pack-priv double | |
| pack-priv double | |
| pack-priv double | |
| private static final PathTransition. |
| Access | Constructor and Description |
|---|---|
| private | Segment(boolean isMoveTo, double toX, double toY, double length, double lengthBefore, double rotateAngle)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public static PathTransition. | |
| public static PathTransition. | |
| public static PathTransition. | |
| public static PathTransition. |
| accumLength | back to summary |
|---|---|
| pack-priv double accumLength | |
| isMoveTo | back to summary |
|---|---|
| pack-priv boolean isMoveTo | |
| length | back to summary |
|---|---|
| pack-priv double length | |
| nextSeg | back to summary |
|---|---|
| pack-priv PathTransition. | |
| prevSeg | back to summary |
|---|---|
| pack-priv PathTransition. | |
| rotateAngle | back to summary |
|---|---|
| pack-priv double rotateAngle | |
| toX | back to summary |
|---|---|
| pack-priv double toX | |
| toY | back to summary |
|---|---|
| pack-priv double toY | |
| zeroSegment | back to summary |
|---|---|
| private static final PathTransition. | |
| Segment | back to summary |
|---|---|
| private Segment(boolean isMoveTo, double toX, double toY, double length, double lengthBefore, double rotateAngle) | |
| convertToClosePath | back to summary |
|---|---|
| public void convertToClosePath(PathTransition. | |
| getZeroSegment | back to summary |
|---|---|
| public static PathTransition. | |
| newClosePath | back to summary |
|---|---|
| public static PathTransition. | |
| newLineTo | back to summary |
|---|---|
| public static PathTransition. | |
| newMoveTo | back to summary |
|---|---|
| public static PathTransition. | |