Zoom in and out / scaling

I would suggest that write a very simple little test program where you put a few objects on the screen, group them and scale them to try to get your arms around how positioning and scaling groups works. Then, if it is still not behaving how you expect, you can post that code here and we can all be on the same page about what you’ve got and what you would like it to do.

hello,

Sorry for the answer delay I’ve been quite busy on other htings :slight_smile:

Here is an exemple that already do not handle the zomme as expected :

function scene:create( event )
local sceneGroup = self.view – add display objects to this group
local bgg = display.newImageRect(sceneGroup,“ressource/backgrounds/293503klklk.jpg”, 800, 430)
bgg.x = display.contentCenterX
bgg.y = display.contentCenterY
local background = display.newImageRect( sceneGroup, “ressource/backgrounds/background.png”, 570, 320 )
background.x = display.contentCenterX
background.y = display.contentCenterY

transition.scaleTo(sceneGroup, {xScale=3.0, yScale=3.0, time=5000})
transition.scaleTo(sceneGroup, {xScale=1, yScale=1, time=5000, delay=5000})

end

adding anywhere :
sceneGroup.anchorChildren = true
sceneGroup.anchorX = .5
sceneGroup.anchorY = .5
does not solve anything .
It does not keep the center at the center of the display.

So if you can fix that piece of code I might somehow be able to understand how to propagate the correction :slight_smile:
thanks in advance.

I think you’ll be more successful if you aren’t trying to manipulate the entire sceneGroup. Try creating a display group that you put the objects into:

    local myGroup = display.newGroup()

    -- Create objects and insert them into myGroup.

    myGroup.anchorChildren = true
    myGroup.anchorX = .5
    myGroup.anchorY = .5
    myGroup.x = display.contentCenterX
    myGroup.y = display.contentCenterY
    sceneGroup:insert( myGroup )

    transition.to( myGroup, { xScale = 3, yScale = 3, time = 5000} )
    transition.to( myGroup, { delay = 5000, xScale = 1, yScale = 1, time = 5000 } )
1 Like

VICTORY!!!

So many thanks !!!
Note to myself : don’t play with SceneGroup never ever again :slight_smile:

Glad to hear everything worked out in the end. :grin:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.