you need to understand how the iOS renderer works, you will see the last position.
you need to call the roatation in small increments, it does not work like other *windows* based programming languages, unfortunately…
local angle = 0
local step =15
local speed = 100
local rotate
local instanceHead = display.newRect(10,100,200,50)
instanceHead:setFillColor(255,0,0)
function rotate()
instanceHead.rotation=angle
angle = angle+step
if angle\<=360 then
timer.performWithDelay(speed ,rotate)
end
end
timer.performWithDelay(1000,rotate) -- starts after 1 second
Now you should be able to see the same being rotated, another thing to note is that you are using rotate, which uses a delta angle from the last position, where as .rotation is the abosulte angle.
So if you want to use :rotate, you can just keep passing it 15 (step) as that is the increment that you are after.
Just created an instanceHead for those that would want to try the code by copy/paste from here.
cheers,
?
[import]uid: 3826 topic_id: 14931 reply_id: 55155[/import]