Jump to content

stage.width


Tobi Reif
 Share

Recommended Posts

In the demo
  http://codepen.io/TobiReif/full/JGGWZJ
this code centers the tree:

wavyTree.x =
  renderer.width / 2 -
  wavyTree.width / 2;

In this version
  http://codepen.io/TobiReif/pen/84b4ad547bea8e35c04dad641bc890c8/
there's "stage.width" instead of "renderer.width", and the tree is not centered.

wavyTree.x =
  stage.width / 2 -
  wavyTree.width / 2;

The content rendered by "renderer.render(stage)" fills the whole width, so I thought the stage would have the full width as well.
 

Link to comment
Share on other sites

Stage is container, its not a camera object. There are no camera objects in pixi.js

container.width is actually part of container.getLocalBounds() which returns a rectangle that contains all childrens of container in his local coordinates. Are you sure you need that value? Do you understand that wavyTree affects stage.width as well?

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...