Sahil Posted April 29, 2018 Share Posted April 29, 2018 Hi Again, I have been working on something using PIXI for the first time, I have got everything to work as intended with one final piece of puzzle left. I was playing with masks and was able to use Graphics shapes as masks and sprites as masks but it seems like text can't be used as a mask. (not that important but was wondering if I am doing something wrong for it to not work) Coming back to my main question, I would like to use entire container as a mask. Is that possible? I tried using container as mask but it doesn't work. Maybe I can use filters to achieve mask using entire container? https://codepen.io/Sahil89/pen/XqpBQv?editors=1010 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 29, 2018 Share Posted April 29, 2018 It can. just use updateText before you set it as a mask. It doesnt get called otherwise: https://github.com/pixijs/pixi.js/blob/dev/src/core/text/Text.js#L368 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 29, 2018 Share Posted April 29, 2018 > Coming back to my main question, I would like to use entire container as a mask. Is that possible? Use renderTexture then put it to sprite. If you understand how it works and want clearner coder, use pixi-layers: http://pixijs.io/examples/#/layers/lighting.js . You dont have to use groups, just swap the root for PIXI.display.Stage and put all things to Layer -> that "layer.getRenderTexture()" will get you screen-sized texture to use as a mask. Yes, screen-size means that its better to use it one-three times , otherwise it'll be slow. Sahil 1 Quote Link to comment Share on other sites More sharing options...
Sahil Posted April 29, 2018 Author Share Posted April 29, 2018 Still just getting started with PIXI so that didn't make sense to me. Plus it seems expensive to process anyway as I will be animating a lot of pixels in container. So I have decided to drop the entire masking idea for now. I will revisit this topic once I go through some of the examples from that page. Thanks. EDIT: I was able to get it to work, just had to clean up everything and start from scratch. Thanks a lot. ivan.popelyshev 1 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.