Jump to content

Pixi mask don't work


jakubdev
 Share

Recommended Posts

Hey,

 

I use few mask in my game. Most of them work fine. They hide what I want and show what only stuff inside mask, but for some reason one mask is diffrent. She use same code, but doesn't hide what's outside of her.

Code used to make mask work:

    const accountsContainer = createContainer('accountsContainer', true, true, true); // containerName, making Window object, make it container fullscreen, interactive
    setSpriteXYLocation(accountsContainer, signUpPositions.CHOOSE_ACCOUNT.ACCOUNTS.START); // as name suggest set in this case container to certain position on viewport
    let availableAccounts = await getUserAccounts(user._id); // fetch accounts


    renderAccountFrame(commonSH, signUpSH, accountsContainer, availableAccounts); // render list of accounts

    const mask = new PIXI.Sprite(PIXI.Texture.WHITE);
    mask.width = accountsContainer.width;
    mask.height = accountsContainer.height;
    accountsContainer.mask = mask;
    accountsContainer.addChild(mask);

 

First video show how this mask behave, when not attached to in this case accountsContainer with code `accountsContainer.mask = mask;`
Second video has mask attached to its container.

 

2022-09-15_21h49_56.gif

2022-09-15_21h55_47.gif

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