4

I am having a custom image, i just need to rotate the image while loading the respective page instead of default indeterminate progress indicator symbol. Do we have any css code to rotate the image continuously. please guide me.

ItachiUchiha
  • 36,135
  • 10
  • 122
  • 176
Karthikram
  • 105
  • 3
  • 9

1 Answers1

7

You don't use css to rotate things in JavaFX 8, use a RotateTransition:

RotateTransition rt = new RotateTransition(Duration.millis(3000), imageView);
rt.setByAngle(360);
rt.setCycleCount(Animation.INDEFINITE);
rt.setInterpolator(Interpolator.LINEAR);
rt.play();
jewelsea
  • 150,031
  • 14
  • 366
  • 406
  • A valuable aspect of this answer is selecting Interpolator.LINEAR. Without this the animation slows down at the beginning and end, which is not what you want for a smooth continuous rotation effect. – Martin CR Aug 09 '22 at 14:01