Jump to content

Zoom the entire camera or stage from the very center of the canvas


shabeerahmedshah
 Share

Recommended Posts

Your container wasn't the size of the canvas.  You need the formula he gave, but using the container width and height, not the canvas.  I think.  I haven't used the pivot.  It just looks that way.

I think Ivan answered on the redundant thread and you better use that.  I haven't used it.

Link to comment
Share on other sites

Oh yeah, sorry I misunderstood. This will fix that:

container.pivot.x = container.width/2;
container.pivot.y = container.height/2;
container.x = canvassize.width/2;
container.y = canvassize.height/2;

Adding rounding to those values will prevent some blurrines if the sizes are not dividable by 2. If your container is scaled then you need to get the real dimensions of the container (either set the scales to 1,1 or use getLocalBounds).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...