Jump to content

Z-order examples outdated?


Recommended Posts


I'm trying to get Layers/Z-order functionality working and following examples on it. There are two different examples on pixijs site



Both have different approaches. But I could not find the functions described there in my pixijs installation.

There's no PIXI.display object, nor is there PIXI.DisplayGroup.

Strange thing is the version I'm running is 4.6.0 (from npm) and the examples above also reportedly running 4.6.0. I also do not find the classes like DisplayGroup in API docs, they are only there in the examples.

What am I missing?

Link to comment
Share on other sites

You are missing a plugin that adds this functionality. Use layers examples with this thing: https://github.com/pixijs/pixi-display 

Also if you dont need to sort through the tree, you can just use simple approach: https://github.com/pixijs/pixi-display/wiki

You've missed third line in those examples: 

//the plugin is here: https://github.com/pixijs/pixi-display/tree/layers, its WIP


Link to comment
Share on other sites

Current version is layers. Display is old one, i'll remove it. I kinda had a test, whether people like old API or new one, because they're totally different. Now "layers" is default branch.

May be this functionality will be included into pixi.js. I think the solution is mature enough and saves time by doing same things automatically that user does manually most of the time. I explained mechanism to several users and they;ve confirmed it.

The main trick is that instead of several z-indices, you can create several "PIXI.display.Layer" and plugin wont use costly sorting operation. if you want 1000 elements on top of other 1000 elements - sorting isn't needed, its O(N) instead of O(N log N).

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.

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.


  • Recently Browsing   0 members

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