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

Texture from Graphics on v5

$
0
0

Hi there!

I'm migrating my engine from v4 to v5, but I am having problems using a graphics object as a texture.

Any ideas?

const graphics = new PIXI.Graphics();

    graphics.lineStyle(
      backgroundStyle.strokeWidth,
      backgroundStyle.strokeColor,
      backgroundStyle.strokeOpacity
    );

    graphics.beginFill(BACKGROUND_COLOR, BACKGROUND_OPACITY);

    graphics.drawRoundedRect(
      ZERO,
      ZERO,
      width,
      height,
      NODE_CORNER_RADIUS
    );

    graphics.endFill();

    const texture = graphics.generateCanvasTexture();

    sprite.texture = texture;

But now I don't know how to get the texture from graphics since I am trying not to use the legacy version for pixi.


Viewing all articles
Browse latest Browse all 3978

Trending Articles