jay3sh Posted November 18, 2017 Share Posted November 18, 2017 Hi, I'm trying to get Layers/Z-order functionality working and following examples on it. There are two different examples on pixijs site http://pixijs.io/examples/#/layers/zorder.js http://pixijs.io/examples/#/display/zorder.js 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? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 18, 2017 Share Posted November 18, 2017 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 jay3sh and GUMI 1 1 Quote Link to comment Share on other sites More sharing options...
jay3sh Posted November 18, 2017 Author Share Posted November 18, 2017 Thanks @ivan.popelyshev. I wasn't aware of pixi.js plugin mechanism. It seems to work now. Which of the two examples are the right way to use pixi-display? Layers or DisplayList? Is there a plan that this functionality will get included in pixi.js core? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 18, 2017 Share Posted November 18, 2017 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). GUMI and jay3sh 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.