GBear Posted July 13, 2015 Share Posted July 13, 2015 HI.I wanna use mask. but i want to set outside part of circlefor example. i write following code ----------------------------------------------------this.mask1 = new PIXI.Graphics();this.mask1.beginFill(0);this.mask1.drawCircle(100,100, 100);this.black = PIXI.Sprite.fromImage('./data/image/512.jpg');this.black.alpha = 0.5;this.black.scale.set(1280/512, 720/512);this.black.mask = this.mask1;this.frontLayer.addChild(this.black);---------------------------------------------------- this case circle part drawn.but i wanna draw outside parthow can i do this? thx Quote Link to comment Share on other sites More sharing options...
xerver Posted July 13, 2015 Share Posted July 13, 2015 Inverse masking is not supported. However sprites can also be masks, so you can draw any shape to a canvas (like the inverse of a normal circle mask) and use that as a texture in a sprite that is your mask. Quote Link to comment Share on other sites More sharing options...
GBear Posted July 16, 2015 Author Share Posted July 16, 2015 hi.how can i my ask by texture.. is it maskFilter?how can i set like the inverse of a normal circle mask?could you tell me simple pseudo code?i can set masks? like 'spr.mask = [mask1, mask2] like filter? Quote Link to comment Share on other sites More sharing options...
xerver Posted July 16, 2015 Share Posted July 16, 2015 Just like you can assign a Graphics object to the .mask property, you can also assign a sprite as a mask. sprite.mask = anotherSprite; 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.