how to continuously spin an image? (code attached)

How does one continuously spin an image?  

With my code below this doesn’t work, it would seem to would have to have a counter that keeps incrementing a “rotation angle” variable by 360 each spin.  Is there an easier way?

local function spinImage (event) transition.to( resetButton, { rotation = -360, time=2000, onComplete=spinImage} ) end spinImage()

Hi Greg,

Try adding the rotation to the current rotation each time, like this… that should work.

[lua]

transition.to( resetButton, { rotation = resetButton.rotation-360, time=2000, onComplete=spinImage } )

[/lua]

Brent

doh  - ok thanks Brent

Hi Greg,

Try adding the rotation to the current rotation each time, like this… that should work.

[lua]

transition.to( resetButton, { rotation = resetButton.rotation-360, time=2000, onComplete=spinImage } )

[/lua]

Brent

doh  - ok thanks Brent

Another (simpler?) way is to just set the rotation angle and time to very large numbers. i.e. rotation=360000, time=2000000. That’ll give you ~30 minutes of rotation at the same apparent speed. 

Another (simpler?) way is to just set the rotation angle and time to very large numbers. i.e. rotation=360000, time=2000000. That’ll give you ~30 minutes of rotation at the same apparent speed.