ArcTo_RotateTrasition1
Code:

package javafxtemplate1;
// without a divider
import javafx.animation.Animation;
import javafx.animation.Interpolator;
import javafx.animation.PathTransition.OrientationType;
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.Circle;
import javafx.scene.shape.ClosePath;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.stage.Stage;
import javafx.animation.PathTransition;
import javafx.animation.RotateTransition;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.PathElement;
import javafx.util.Duration;
import javafx.util.converter.NumberStringConverter;
/**
*
* @author Manas9
*/
public class JavaFXTemplate1 extends Application {
//


@Override

public void start(Stage primaryStage)
{
Label label1 = new Label("Click On Red Ball");
label1.setLayoutX(10);label1.setLayoutY(220);
final Circle circle1 = new Circle();
circle1.setCenterX(-5);circle1.setCenterY(5);
circle1.setRadius(10.0f); circle1.setFill(Color.WHITE);
final Circle circle2 = new Circle();
circle2.setCenterX(50);circle2.setCenterY(100);
circle2.setRadius(10.0f); circle2.setFill(Color.RED);
final Circle circle3 = new Circle();
circle3.setCenterX(50);circle3.setCenterY(100);
circle3.setRadius(30.0f); circle3.setFill(Color.RED);


PathElement[] path = squareOrbit();
Path track = new Path();
track.setStroke(Color.BROWN);
track.setStrokeWidth(10);
track.getElements().addAll(path);

Path divider = new Path();
divider.setStroke(Color.WHITE);
divider.setStrokeWidth(1);
divider.getStrokeDashArray().addAll(10.0, 10.0);
divider.getElements().addAll(path);
//
Path Spinner = new Path();
Spinner.setStroke(Color.YELLOW);
Spinner.setStrokeWidth(1);
Spinner.getStrokeDashArray().addAll(10.0, 10.0);
Spinner.getElements().addAll(path);

//

PathTransition anim = new PathTransition();
anim.setNode(circle1);// circle object
anim.setPath(track);// track
anim.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT);
anim.setInterpolator(Interpolator.LINEAR);
anim.setDuration(new Duration(6000));
anim.setCycleCount(Timeline.INDEFINITE);
//
RotateTransition spin = new RotateTransition();
spin.setNode(divider);
spin.setFromAngle(0);
spin.setToAngle(360);
spin.setInterpolator(Interpolator.LINEAR);
spin.setCycleCount(Timeline.INDEFINITE);
spin.setDuration(new Duration(3000));
//

Group root = new Group();
root.getChildren().addAll(label1,circle3,divider,circle2, circle1,Spinner);
//root.getChildren().addAll(track, circle1);
//root.getChildren().addAll(divider, circle1);
root.setTranslateX(50);
root.setTranslateY(50);
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();}

else{
spin.play(); }
});
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
PathElement[] path =
{
new MoveTo(0, 200), // zero to 300 streched
// new ArcTo(100,100, 50,slider1.getValue(),50,false,false),
new ArcTo(10, 10, 0, 0,0,false,false),
//new ArcTo(200, 200, 10, 10,200,false,false),
new ClosePath()
};
return path;
}
public static void main(String[] args) {
launch(args);

}

}
 

 
 
Displays: