Rotate something 45 degrees back and forth

Hello!

I know how to rotate something in a full circle, but I am wondering how to rotate something only 45 degrees (more or less) and then rotate it back 45 degrees.

Thanks so much! [import]uid: 86879 topic_id: 16825 reply_id: 316825[/import]

create functions forth and back

forth will rotate the object to 45 degrees, and have an onComplete parameter equal to back
back will rotate the object to 0 degrees, and have an onComplete parameter equal to forth

call forth

[import]uid: 6459 topic_id: 16825 reply_id: 63037[/import]

Have a read here http://howto.oz-apps.com/2011/07/how-to-pulsate-using-coronasdk.html

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 16825 reply_id: 63058[/import]

you may try this
[lua]local image = display.newRect(240,240,25,35)
timer.performWithDelay(500,function() if image.rotation == 45 then image.rotation = 0 else image.rotation = 45 end end ,-1)[/lua] [import]uid: 71210 topic_id: 16825 reply_id: 63069[/import]

you can try the c=b+a, therefor a=c-b algebriac expression

local rotation = 0  
...  
timer.performWithDelay(500,image.rotation = math.abs(rotation-45) ,-1)  

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 16825 reply_id: 63070[/import]