Class: Application


Convenience class to create a new PIXI application.

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

new PIXI.Application (options)

Name Type Attributes Default Description
options object <optional>

The optional renderer parameters.

options.autoStart boolean <optional>

Automatically starts the rendering after the construction. Note: Setting this parameter to false does NOT stop the shared ticker even if you set options.sharedTicker to true in case that it is already started. Stop it by your own.

options.width number <optional>

The width of the renderers view.

options.height number <optional>

The height of the renderers view.

options.view HTMLCanvasElement <optional>

The canvas to use as a view, optional.

options.useContextAlpha boolean <optional>

Pass-through value for canvas' context alpha property. If you want to set transparency, please use backgroundAlpha. This option is for cases where the canvas needs to be opaque, possibly for performance reasons on some older devices.

options.autoDensity boolean <optional>

Resizes renderer view in CSS pixels to allow for resolutions other than 1.

options.antialias boolean <optional>

Sets antialias

options.preserveDrawingBuffer boolean <optional>

Enables drawing buffer preservation, enable this if you need to call toDataUrl on the WebGL context.

options.resolution number <optional>

The resolution / device pixel ratio of the renderer.

options.forceCanvas boolean <optional>

prevents selection of WebGL renderer, even if such is present, this option only is available when using pixi.js-legacy or @pixi/canvas-renderer modules, otherwise it is ignored.

options.backgroundColor number <optional>

The background color of the rendered area (shown if not transparent).

options.backgroundAlpha number <optional>

Value from 0 (fully transparent) to 1 (fully opaque).

options.clearBeforeRender boolean <optional>

This sets if the renderer will clear the canvas or not before the new render pass.

options.powerPreference string <optional>

Parameter passed to webgl context, set to "high-performance" for devices with dual graphics card. (WebGL only).

options.sharedTicker boolean <optional>

true to use PIXI.Ticker.shared, false to create new ticker. If set to false, you cannot register a handler to occur before anything that runs on the shared ticker. The system ticker will always run before both the shared ticker and the app ticker.

options.sharedLoader boolean <optional>

true to use PIXI.Loader.shared, false to create new Loader.

options.resizeTo Window | HTMLElement <optional>

Element to automatically resize stage to.


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

 // Add the view to the DOM

 // ex, add display objects


loader PIXI.Loader readonly

Loader instance to help with asset loading.

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 HTMLCanvasElement readonly

Reference to the renderer's canvas element.


PIXI.Application.registerPlugin (plugin) void static


Register a middleware plugin for the application

Name Type Description
plugin PIXI.IApplicationPlugin

Plugin being installed

destroy (removeView, stageOptions) void


Destroy and don't use after this.

Name Type Attributes Default Description
removeView Boolean <optional>

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>

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>

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>

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.