CraigBall Posted November 18, 2016 Share Posted November 18, 2016 I've got an odd issue with multiple masks in the hierarchy. When I apply a mask to a container, if any sub containers contain masks, the sub container masks appear to move with the parent mask. I expected the sub container mask to remain stationary as I move the parent mask. NOTE: This doesn't happen with older versions of PIXI - this works as I expected with version 3.0.2. The version of PIXI I see this on is version 4.0.3. Here's the sample code I've used. - cat.png is the background image - graphics is the stationary sub container mask - horse.png is the mask I am moving around Thanks. Craig <html> <head> <title>Mask Issue</title> <script src="pixi.js"></script> </head> <body> <script> var gameContainer = new PIXI.Container(); var renderer = PIXI.autoDetectRenderer(800, 600); document.body.appendChild(renderer.view); var subContainer = new PIXI.Container(); gameContainer.addChild(subContainer); var cat = new PIXI.Sprite.fromImage("cat.jpg"); subContainer.addChild(cat); var graphics = new PIXI.Graphics(); graphics.beginFill(0xFFFFFF, 1); graphics.drawRect(50, 50, 200, 200); graphics.endFill(); subContainer.mask = graphics; subContainer.addChild(graphics); var horse = new PIXI.Sprite.fromImage("horse.png"); gameContainer.mask = horse; gameContainer.addChild(horse); requestAnimationFrame(animate); function animate(time) { requestAnimationFrame(animate); var radian = Math.PI * 2 * time / 1000; var radius = 100; horse.position.set(radius + Math.sin(radian) * radius, radius - Math.cos(radian) * radius); renderer.render(gameContainer); } </script> </body> </html> Quote Link to comment Share on other sites More sharing options...
CraigBall Posted November 18, 2016 Author Share Posted November 18, 2016 I've tried this on PIXI version 4.2.2 and it's still an issue. Quote Link to comment Share on other sites More sharing options...
xerver Posted November 18, 2016 Share Posted November 18, 2016 Please post the issue with a running example case on the GitHub issue tracker. https://github.com/pixijs/pixi.js/blob/dev/CONTRIBUTING.md https://github.com/pixijs/pixi.js/issues Quote Link to comment Share on other sites More sharing options...
CraigBall Posted November 21, 2016 Author Share Posted November 21, 2016 Thanks xerver - posted. https://github.com/pixijs/pixi.js/issues/3326 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.