In my first Corona iPhone app I move objects around the screen with transition.to animations. One of the key requirements is to rotate objects around an axis outside of the object. Sounds like a great application for the xReference attribute, right?
Well it works really well until I change the xReference value for a later transition. This makes the object jump to a position which it would have ended up if I had done the previous rotation without to xReference set correctly.
Is this a bug or a feature?
Thanks, Oliver
Sample code:
[lua]local rect = display.newRect(100, 200, 80, 20)
rect.strokeWidth = 2
rect:setFillColor(140, 140, 140)
rect:setStrokeColor(180, 180, 180)
rect.yReference = -50
jump = function ()
rectw = rect.width
recth = rect.height
rectx = rect.x
recty = rect.y
rectr = rect.rotation
display.remove( rect )
local rect = display.newRect((rectx - 80 / 2), (recty - 20 / 2), 80, 20)
rect.strokeWidth = 2
rect:setFillColor(140, 140, 140)
rect:setStrokeColor(180, 180, 180)
rect.rotation = rectr
rect.yReference = 50
local title2 = display.newText( rectx, 200, 40, “GurmukhiMN-Bold”, 20 )
local title2 = display.newText( recty, 200, 80, “GurmukhiMN-Bold”, 20 )
local title2 = display.newText( rectr, 200, 120, “GurmukhiMN-Bold”, 20 )
local title2 = display.newText( rect.x, 100, 40, “GurmukhiMN-Bold”, 20 )
local title2 = display.newText( rect.y, 100, 80, “GurmukhiMN-Bold”, 20 )
local title2 = display.newText( rect.rotation, 100, 120, “GurmukhiMN-Bold”, 20 )
end
transition.to( rect, { time=2000, delay=100, rotation=90, onComplete=jump } )[/lua] [import]uid: 69642 topic_id: 14451 reply_id: 314451[/import]