Jump to content

PixiJS: Baking PIXI.Container to a PIXI.Texture


toowren
 Share

Recommended Posts

Hello, is it possible somehow to 'bake' a PixiJS container to texture.

let container = new PIXI.Container();
container.x = 256;
container.y = 256;

let graphics = new PIXI.Graphics();

graphics.beginFill(0xFF00FF);
graphics.drawRoundedRect(0, 0, 128, 128, 16);
graphics.endFill();

container.addChild(graphics);

let arrow = PIXI.Sprite.from(resources.arrowOut.texture);
arrow.x = 64 - arrow.width / 2;
arrow.y = 64 - arrow.height / 2;
container.addChild(arrow);

container.cacheAsBitmap = true;
        
app.stage.addChild(container);

Since if there is .cacheAsBitmap option, it has to be cached somewhere and I want to use it further as PIXI.Texture.

Screenshot from 2022-10-11 12-04-15.png

Link to comment
Share on other sites

  • 5 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...