PIXI.Prepare
class Prepare extends PIXI.BasePrepare
The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.
Do not instantiate this plugin directly. It is available from the renderer.plugins
property.
See PIXI.CanvasRenderer#plugins or {@link PIXI.Renderer#plugins}.
// Create a new application
const app = new PIXI.Application();
document.body.appendChild(app.view);
// Don't start rendering right away
app.stop();
// create a display object
const rect = new PIXI.Graphics()
.beginFill(0x00ff00)
.drawRect(40, 40, 200, 200);
// Add to the stage
app.stage.addChild(rect);
// Don't start rendering until the graphic is uploaded to the GPU
app.renderer.plugins.prepare.upload(app.stage, () => {
app.start();
});
Constructor
new PIXI.Prepare(renderer: PIXI.Renderer) → {}
Name | Type | Description |
---|---|---|
renderer | PIXI.Renderer |
A reference to the current renderer |
Summary
Properties inherited from BasePrepare
Array<Function> |
|
Array<Function> |
|
boolean |
|
Array<Function> |
|
Array<any> |
Collection of items to uploads at once. |
PIXI.AbstractRenderer |
Reference to the renderer. |
any |
|
Methods inherited from BasePrepare
this |
|
void |
Destroys the plugin, don't use after this. |
this |
|
this |
|
Promise<void> |
|
void |
|
void |
|