Class: Application

PIXI.Application

Convenience class to create a new PixiJS application.

This class automatically creates the renderer, ticker and root container.

new PIXI.Application (options)

Name Type Attributes Description
options Partial<PIXI.IApplicationOptions> <optional>

The optional application and renderer parameters.

Example

 import { Application, Sprite } from 'pixi.js';

 // Create the application
 const app = new Application();

 // Add the view to the DOM
 document.body.appendChild(app.view);

 // ex, add display objects
 app.stage.addChild(Sprite.from('something.png'));

Members

PIXI.Application._plugins PIXI.IApplicationPlugin[] static

Collection of installed plugins.

WebGL renderer if available, otherwise CanvasRenderer.

resizeTo Window | HTMLElement

The HTML element or window to automatically resize the renderer's view element to match width and height.

screen PIXI.Rectangle readonly

Reference to the renderer's screen rectangle. Its safe to use as filterArea or hitArea for the whole screen.

The root display container that's rendered.

ticker PIXI.Ticker

Ticker for doing render updates.

Default Value:
  • PIXI.Ticker.shared

view PIXI.ICanvas readonly

Reference to the renderer's canvas element.

Methods

destroy (removeView, stageOptions) void

Destroy and don't use after this.

Name Type Attributes Default Description
removeView boolean <optional>
false

Automatically remove canvas from DOM.

stageOptions object | boolean <optional>

Options parameter. A boolean will act as if all options have been set to that value

stageOptions.children boolean <optional>
false

if set to true, all the children will have their destroy method called as well. 'stageOptions' will be passed on to those calls.

stageOptions.texture boolean <optional>
false

Only used for child Sprites if stageOptions.children is set to true. Should it destroy the texture of the child sprite

stageOptions.baseTexture boolean <optional>
false

Only used for child Sprites if stageOptions.children is set to true. Should it destroy the base texture of the child sprite

render () void

Render the current stage.

resize () void

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.

start () void

Convenience method for starting the render.

stop () void

Convenience method for stopping the render.