Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX RotateTransition indefinite halts

The problem with the code below is that between two animations there is a pause of about half a second. I'd like the node to spin continuously.

RotateTransition rt = new RotateTransition(Duration.seconds(2), syncNode);
rt.setFromAngle(0);
rt.setToAngle(360);
rt.setCycleCount(Animation.INDEFINITE);
rt.play();
like image 754
progonkpa Avatar asked May 26 '16 09:05

progonkpa


1 Answers

The Interpolator used by default makes the rotation "speed up" at the start and "slow down" at the end, which is why you get the behaviour you described.

Use the LINEAR interpolator instead to get a animation with constant speed:

rt.setInterpolator(Interpolator.LINEAR);
like image 107
fabian Avatar answered Sep 29 '22 14:09

fabian