Try applying an Action
to the button.
For example, to make the Button
rotate once apply a rotate action:
btnSett.addAction(Actions.rotateBy(360, 1));
This will rotate btnSett
once over one second.
To make something continuously rotate you can apply a repeated action, and actions can also be in sequence, for example;
btnSett.addAction(Actions.repeat(RepeatActions.FOREVER,
Actions.sequence(
Actions.rotateBy(360, 1), // First, rotate once
Actions.rotateTo(0)); // Then, instantly set the rotation to 0 so that the previous action makes sense again.
You'll also need to set the origin of the Button
to it's center first;
btnSett.setOrigin(btnSett.getWidth() / 2, btnSett.getHeight() / 2);
To make the actions code look cleaner consider making static imports of the methods in Actions
, that way the code can look more like;
btnSett.addAction(repeat(RepeatActions.FOREVER,
sequence(rotateBy(360, 1),
rotateTo(0));