renathy
renathy

Reputation: 5355

pixijs: show and hide container with all elements in it

I have tab: PIXI.Container with a bunch of sprites on it. I believe this should be so easy, I am new to Pixi, but have knowledge in JS.

I have button. Clicking on button should show/hide given container. However, I cannot get it work.

btn.on('pointerdown',(event) => this.onClick(btn, tab));

How should I hide container with all sprites on it? And then how can I show back container with all sprites on it?

Upvotes: 4

Views: 5283

Answers (2)

domis86
domis86

Reputation: 1357

Try using pixijs.download/dev/docs/PIXI.Container.html#visible

example: https://github.com/kittykatattack/learningPixi#displaying-sprites <- here sprite is hidden using anySprite.visible = false; , but you can do it similarily on container too.

Upvotes: 4

Nasir Moghtaderi
Nasir Moghtaderi

Reputation: 1

you can use one of these :
anySprite.visible = false
or
anySprite.alpha = 0;

Upvotes: 0

Related Questions