@golubev9,
You can place all of the content for the scene that needs to rotate in a display group and rotate the display group.
Assuming your group is named ‘rotator’, you could have a button rotate the scene like this:
onRotate= function ( event )
if( event.phase ~= "ended" )
then return true
end
if(rotator.rotation == 0 ) then
rotator:setReferencePoint( display.CenterReferencePoint )
transition.to( rotator, {rotation=90, time = 500} )
else
rotator:setReferencePoint( display.CenterReferencePoint )
transition.to( rotator, {rotation=0, time = 500} )
end
return true
end
Please note: All objects within the group (rotator) still have their axes updated relative to the rotator. i.e. When rotated to 90-degrees, Adding 10 to an object’s x translates to adding 10 to the y position as it is rendered.
Here is a sample of what this in action:
http://www.youtube.com/watch?v=JBcXvUssPaw
Edit: If I wasn’t clear above, put all of your content in a display group and put that group in screenGroup:
local rotator
function scene:createScene( event )
screenGroup = self.view
rotator = display.newGroup() -- This is the group that gets rotated
screenGroup:insert( rotator )
-- After this, add your content to rotator, NOT screenGroup
end
[import]uid: 110228 topic_id: 32449 reply_id: 129100[/import]