Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Mask using container or its pixels?


Sahil
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...