Giter VIP home page Giter VIP logo

Comments (9)

ivanpopelyshev avatar ivanpopelyshev commented on June 10, 2024 1

Oh, now i know whats wrong and i think i can reproduce it. thank you!

from layers.

ivanpopelyshev avatar ivanpopelyshev commented on June 10, 2024

you should add mask to stage too, there are no guarantees for stage-less masks.

It should work, need complete example

from layers.

gsotirov avatar gsotirov commented on June 10, 2024

Thanks for the swift response, Ivan.
Yes, when I added it directly to the stage it worked,
But if the display object used as a mask is added to a Container that is rendered on a specific layer, the above-mentioned problem happened. That was the case with my initial implementation.

const stage = new display.Stage();
const group = new Group(0, true);
const layer = new Layer(group);

stage.addChild(layer);

const container = new Container(); // The container has some children inside, 1 of which will be used as a mask.
container.parentGroup = group;

layer.mask = container.children[0];

from layers.

gsotirov avatar gsotirov commented on June 10, 2024

You are welcome. @ivanpopelyshev
Since I guess it could take a while before the eventual fix is added, can you share where the issue is so I can try a temp solution from my end ?

from layers.

ivanpopelyshev avatar ivanpopelyshev commented on June 10, 2024

most possibly something with if (this._activeParentLayer) . It should be ignored if element is a mask

from layers.

ivanpopelyshev avatar ivanpopelyshev commented on June 10, 2024

@gsotirov actually, if your layer has only dynamic objects - they wont affect bounds, and bounds are required for sprite masks. You may add filterArea to that layer, like layer.filterArea = renderer.screen , or override calculateBounds or add a graphics with a rect that has alpha=0.

Please confirm that was the issue!

from layers.

ivanpopelyshev avatar ivanpopelyshev commented on June 10, 2024

Here's important notice for you: https://github.com/pixijs/layers#important-notice-about-filters-and-masks

from layers.

ivanpopelyshev avatar ivanpopelyshev commented on June 10, 2024

Nope, I failed to reproduce your case. Can you please put it on jsfiddle or pixi-playground or codesandbox?

from layers.

gsotirov avatar gsotirov commented on June 10, 2024

Thanks @ivanpopelyshev, for the notice.

Sorry for the late response, I've been busy.
While making the example, I was able to make it work, but only if the mask is rendered on the same layer I wanted to mask with it. If I want to use the mask to mask two layers, it won't work.

Here's what I did: https://codesandbox.io/s/pixi-playground-forked-8lwo1?file=/src/index.js

Comment/Uncomment lines 49 & 50 to reproduce.

from layers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.