VLineTo_HLineTo2
 
 
Code :

package javafxtemplate1;
// Path__RotationTransition
import javafx.animation.Animation;
import javafx.animation.Interpolator;
import javafx.animation.PathTransition;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.ArcTo;
import javafx.scene.shape.ClosePath;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.stage.Stage;
import javafx.animation.RotateTransition;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Circle;
import javafx.scene.shape.CubicCurve;
import javafx.scene.shape.CubicCurveTo;
import javafx.scene.shape.HLineTo;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.PathElement;
import javafx.scene.shape.StrokeLineCap;
import javafx.scene.shape.VLineTo;
import javafx.util.Duration;

/**
*
* @author Manas9
*/
public class JavaFXTemplate1 extends Application {
//

@Override

public void start(Stage primaryStage)
{
Label label1 = new Label("Click On the screen");
label1.setLayoutX(10);label1.setLayoutY(220);

// PathElement array of mixed getElements
final Circle circle1 = new Circle();
circle1.setCenterX(10);circle1.setCenterY(10);
circle1.setRadius(10.0f); circle1.setFill(Color.WHITE);
PathElement[] path = squareOrbit();
Path track = new Path();
track.setStroke(Color.BROWN);
track.setStrokeWidth(10);
track.getElements().addAll(path);

RotateTransition spin = new RotateTransition();
spin.setNode(cubic1);
spin.setFromAngle(0);
spin.setToAngle(-360);// anti-clock spin
spin.setRate(2.0);
spin.setInterpolator(Interpolator.LINEAR);
spin.setCycleCount(Timeline.INDEFINITE);
spin.setDuration(new Duration(5000));
spin.setAutoReverse(true);
//
PathTransition anim = new PathTransition();
anim.setNode(circle1);
//anim.setFromAngle(0);
//anim.setToAngle(360);// clock spin
anim.setPath(track);
anim.setInterpolator(Interpolator.LINEAR);
anim.setCycleCount(Timeline.INDEFINITE);
anim.setDuration(new Duration(5000));
anim.setAutoReverse(false);
//

Group root = new Group();
root.getChildren().addAll(label1,circle1, cubic1, track);
//root.getChildren().addAll(track, circle1);
//root.getChildren().addAll(divider, circle1);
root.setTranslateX(50);
root.setTranslateY(100);
root.setOnMouseClicked(e ->
{
Animation.Status status1 = anim.getStatus();
Animation.Status status2 = spin.getStatus();

if (status1 == Animation.Status.RUNNING &&
status1 != Animation.Status.PAUSED){
anim.pause();}

else{
anim.play();
}

//
if (status2 == Animation.Status.RUNNING &&
status2 != Animation.Status.PAUSED){
spin.pause();
//track.visibleProperty().set(true);
}
else{
spin.play();
// track.visibleProperty().set(false);
}
});
Scene scene = new Scene(root, 500, 500, Color.DARKGRAY);

primaryStage.setTitle("PathTransition Demo");
primaryStage.setScene(scene);
primaryStage.show();
}
//


//
private PathElement[] squareOrbit()
{
// ArcTo.ArcTo(double,double,double,double,double,boolean,boolean)
//x, y, XAxis Rotation
//CubicCurveTo curve = new CubicCurveTo();
//curve= createStartingCurve();

PathElement[] path =
{
new MoveTo(0, 200), // zero to 300 streched
//straight line arcto
//new ArcTo(20,20,100,100,0,false,false),
//new CubicCurveTo(0, 0,150,250,150,50),
new VLineTo(-50), new HLineTo(100), new VLineTo(50),new HLineTo(10),
//new ClosePath()

};
return path;
}

public static void main(String[] args) {
launch(args);

}

}

Runtime Displays: