Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3980

PIXI Sprite displays in black

$
0
0

I am trying to set a Sprite as a background in my viewport. The grid.png is 23040 x 9984 pixels.

   this.app.loader
      .add("grid", require("./assets/grid.png"))
      .load((loader, resources) => {
        const grid = new PIXI.Sprite(resources.grid.texture);
        grid.anchor.set(0, 0);
        grid.scale.set(1);
        this.container.addChild(grid);
      });


The Sprite shows in my Container but only in black. If I try with a smaller png (25 x 25 pixels) it works.

I also made sure my viewport world width and height were big enough :

   this.viewport = new Viewport({
      screenWidth: 953,
      screenHeight: 409,
      worldWidth: 25000,
      worldHeight: 10000,
      interaction: this.app.renderer.plugins.interaction 
    });


Here is the sandbox code https://codesandbox.io/s/pixi-sprite-loading-cn7re?file=/src/App.vue:572-875


Viewing all articles
Browse latest Browse all 3980

Trending Articles