如何在 Corona 中同时移动和旋转图像?
How to move and rotate an image at the same time in Corona?
我正在尝试在游戏中投掷飞镖。
我可以用
移动星星
bulletTransition[bulletCounter] = transition.to(bullets[bulletCounter], {x=-250, time=2000, onComplete=function(self)
if(self~=nil) then
display.remove(self)
end
end})
我知道我可以用
旋转东西
transition.to( bullets[bulletCounter], { rotation = bullets[bulletCounter].rotation-360, time=2000, onComplete=spinImage } )
但是如何让平移和旋转同时发生呢?
您可以在一次转换中同时调用两者。就像:
local rect = display.newRect(300,100,50,50) -- Create object
transition.to(rect, {x=-250, rotation = rect.rotation-360,time=2000,} ) -- Transition call
我正在尝试在游戏中投掷飞镖。 我可以用
移动星星bulletTransition[bulletCounter] = transition.to(bullets[bulletCounter], {x=-250, time=2000, onComplete=function(self)
if(self~=nil) then
display.remove(self)
end
end})
我知道我可以用
旋转东西transition.to( bullets[bulletCounter], { rotation = bullets[bulletCounter].rotation-360, time=2000, onComplete=spinImage } )
但是如何让平移和旋转同时发生呢?
您可以在一次转换中同时调用两者。就像:
local rect = display.newRect(300,100,50,50) -- Create object
transition.to(rect, {x=-250, rotation = rect.rotation-360,time=2000,} ) -- Transition call