Jump to content

Positioning Container


soop
 Share

Recommended Posts

Hello!
I want to center the Container with the preservation of the perspective and so that it always fits into the window. But Pixi Container doesn't have a constant size. How do I achieve this?
 

Untitled Diagram.png

Edited by soop
Link to comment
Share on other sites

Pixi doesnt have elements that have fixed width/height, containers are based on flash DisplayObjectContainer.

There were many threads like this, please use search or try to read everything :)

Basically, you have to assign width somewhere else, in your variable.

If you have screen size, and you have your wanted "width" of container (which is not pixi container width), you can calculate scale to fit or cover the screen. That scale can be assigned to pixi element because scale is first-class citizen in pixi. Width isn't.

This is also a basic transform exercise - one of reasons we dont provide scaling window solution. If you dont exercise with transforms, you will fail later on more difficult tasks. It wont be easy for us to explain you how to use those things later.

Edited by ivan.popelyshev
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...