1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Pixi JS tips

1
Last updated at Posted at 2019-09-03
その1 Spriteのremove どこに配置したか分からなくなってもremoveできる

通常の方法


let gazou = new PIXI.Sprite(PIXI.Texture.fromImage("img/MenuButton.png"));
app.stage.addChild(gazo);
app.stage.remove()

同じブロック内にある場合、困ることは少ないのですが、、遠い場所に設置したスプライトの場合、removeに困ることが多々あります。setTag等で削除もできるのですが、順番通りにしかremoveできないため困惑しました。
以下の方法で自由にremove可能です。

this.parent.removeChild(this);
myContainer.parent.removeChild(myContainer);
```

##### その2 Chromeは WebGLをサポートしていない?
```JavaScript 
<script src="//cdnjs.cloudflare.com/ajax/libs/pixi.js/5.0.3/pixi.min.js"></script>
```

なぜかCDNからとってきてPixi v5以上で試したら
```
Uncaught Error: WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.
    at Function.e.create (Renderer.js:49)
    at Vr (autoDetectRenderer.js:36)
```
環境は、Chrome バージョン: 76.0.3809.132 とWebServer Chrome 200 OKというクロームアプリで動かしています。
なぜか、バージョンを下げたらうまく動きました。4.9で一部描画にバグ、4.8で今のところ問題なく稼働しています。

```
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.8.8/pixi.min.js"></script>
```
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?