Class PathTransition

java.lang.Object

public final class PathTransition extends Transition
This 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();

 ...

 
 
Since:
JavaFX 2.0
See Also: