Skip to content
Advertisement

Rotate image continuously

I want to rotate the ring image constantly in anticlockwise direction here is my code

JavaScript

Advertisement

Answer

I guess the Actions are what you are looking for.
An Action can be added to Actors (and subclasses) and they will be performed inside the act(delta) method, of the Actor.
In your case you could use the Actions.rotateBy(float rotationAmount, float duration) and let it repeat forever by using Actions.repeat(RepeatAction.FOREVER, rotateAction).

So your final code should look like this:

JavaScript

Where rotation is the rotation amount (i guess in degrees, but i am not sure) and duration is the time it should take to rotate by the given amount (given in seconds).

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement