corporalik Posted December 23, 2015 Share Posted December 23, 2015 Hello all.I'm trying to apply mask which is sprite and contains a lot of graphic objects, to another sprite with other graphic objects, but it's not working.Here is my example https://jsfiddle.net/jtzqhge2/1/As you can see on result there is only one piece of mask, but I attached 5 pieces of graphic objects to mask container and then apply that container as mask. Any ideas? White object is what I want to mask, red objects are parts of mask Here is result Thanks Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 24, 2015 Share Posted December 24, 2015 https://jsfiddle.net/jtzqhge2/3/ - if you use graphics object as a mask, it will work. According to https://github.com/pixijs/pixi.js/blob/master/src/core/renderers/webgl/managers/StencilManager.js#L314 , only one object can be used for masking WebGLMaskManager.prototype.pushMask = function (maskData){ this.renderer.setObjectRenderer(this.renderer.plugins.graphics); if (maskData.dirty) { this.renderer.plugins.graphics.updateGraphics(maskData, this.renderer.gl); } if (!maskData._webGL[this.renderer.gl.id].data.length) { return; } this.pushStencil(maskData, maskData._webGL[this.renderer.gl.id].data[0]);}; Quote Link to comment Share on other sites More sharing options...
corporalik Posted December 24, 2015 Author Share Posted December 24, 2015 Yes, thank you for the solution, I did the same.I just somewhere read that I can create sprite, then add some other sprites to this sprite and apply this sprite as mask to another sprite object.(привет) Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 24, 2015 Share Posted December 24, 2015 Its possible, I just saw demo few days ago. Let me find it... UPD. found something: https://github.com/pixijs/pixi.js/issues/1639 (что за проект?) Quote Link to comment Share on other sites More sharing options...
corporalik Posted December 24, 2015 Author Share Posted December 24, 2015 Thanks(коммерческий, гэмблинг, переписываю с флеша) 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.