Create new Application instance
Example
import { Application, Sprite } from 'pixi.js';
// Create the application
const app = new Application();
await app.init({ width: 800, height: 600 });
// Add the view to the DOM
document.body.appendChild(app.canvas);
// ex, add display objects
app.stage.addChild(Sprite.from('something.png'));
Members
Collection of installed plugins.
Reference to the renderer's canvas element.
renderer Renderer
WebGL renderer if available, otherwise CanvasRenderer.
The HTML element or window to automatically resize the renderer's view element to match width and height.
screen Rectangle readonly
Reference to the renderer's screen rectangle. Its safe to use as filterArea
or hitArea
for the whole screen.
stage Container
The root display container that's rendered.
ticker Ticker
Ticker for doing render updates.
- Default Value:
- Ticker.shared
Reference to the renderer's canvas element.
Methods
Destroys the application and all of its resources.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
rendererDestroyOptions |
object | boolean |
<optional> |
false |
The options for destroying the renderer. |
rendererDestroyOptions.removeView |
boolean |
<optional> |
false |
Removes the Canvas element from the DOM. |
options |
object | boolean |
<optional> |
false |
The options for destroying the stage. |
options.children |
boolean |
<optional> |
false |
If set to true, all the children will have their destroy method
called as well. |
options.texture |
boolean |
<optional> |
false |
Only used for children with textures e.g. Sprites. If options.children is set to true, it should destroy the texture of the child sprite. |
options.textureSource |
boolean |
<optional> |
false |
Only used for children with textures e.g. Sprites. If options.children is set to true, it should destroy the texture source of the child sprite. |
options.context |
boolean |
<optional> |
false |
Only used for children with graphicsContexts e.g. Graphics. If options.children is set to true, it should destroy the context of the child graphics. |
Name | Type | Attributes | Description |
---|---|---|---|
options |
Partial<ApplicationOptions> |
<optional> |
The optional application and renderer parameters. |
Render the current stage.
Execute an immediate resize on the renderer, this is not
throttled and can be expensive to call many times in a row.
Will resize only if resizeTo
property is set.
Convenience method for starting the render.
Convenience method for stopping the render.