Pixi.js: Container overflow hidden

Created on 22 Oct 2018  路  6Comments  路  Source: pixijs/pixi.js

image

Hi,
I have a case like this above. I need to have 2 Containers with some children containers. Container B is scrollable - I'm changing position of children containers inside. In case when some content is out of the Container B top edge I would like to hide it... Basically I'm looking for something like "overflow: hidden" from CSS. Do you have some idea how to deal with it ???

Most helpful comment

Try something like this:

const mask = new PIXI.Sprite(Texture.WHITE);
mask.width = 100;
mask.height = 20;
containerB.addChild(mask); // make sure mask it added to display list somewhere!
containerB.mask = mask;

All 6 comments

Masks :)

Try something like this:

const mask = new PIXI.Sprite(Texture.WHITE);
mask.width = 100;
mask.height = 20;
containerB.addChild(mask); // make sure mask it added to display list somewhere!
containerB.mask = mask;

Hi,
Thanks for your responses! In case when I would use mask, it will cover children elements from ContainerA. (ContainerA also is scrollable). It will look like this:

image

:(

Please provide some code of what you're doing.

YES!
@bigtimebuddy you are right!
containerB.mask = mask; did a trick ..

thank you very much I really appreciate your help.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lucap86 picture lucap86  路  3Comments

YuryKuvetski picture YuryKuvetski  路  3Comments

courtneyvigo picture courtneyvigo  路  3Comments

sntiagomoreno picture sntiagomoreno  路  3Comments

Makio64 picture Makio64  路  3Comments