3

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?

Omiod
  • 11,285
  • 11
  • 53
  • 59
renathy
  • 5,125
  • 20
  • 85
  • 149
  • 1
    Try using https://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. – domis86 Nov 23 '20 at 21:46
  • 1
    It works, please, add it as answer. I somehow missed visibile option... – renathy Nov 23 '20 at 23:23

2 Answers2

2

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.

Klesun
  • 12,280
  • 5
  • 59
  • 52
domis86
  • 1,227
  • 11
  • 9
0

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