Jump to content

Moving a Mask


Son Tran-Nguyen
 Share

Recommended Posts

It's a little bit hard to extract the code out since I'm writing using entity system. So I went a head and created a JSFiddle using the masking example from Pixi website, and with rubber duck debugging, I saw that I need to redraw the mask in every tick.

 

Which is kinda trouble some, since now that I need another system to update of the mask's position. But that's okay. I guess my use case of mask is not that practical :)

 

Thank @hubert for suggesting me about debugging it.

Link to comment
Share on other sites

Yes if you add the mask as a child of the sprite it's position become relative to it.

 

You can either change your paths position to lower values so its on top on the sprite, or set the position of the mask to negative value like i did here:

 

http://jsfiddle.net/cz8jhq1v/1/

 

btw why are you drawing the mask every frame? Is it because you want to use a different shape of mask every frame?

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...