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 Description
options object optional

The optional renderer parameters.

Name Type Default Description
autoStart boolean true 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.

width number 800 optional

The width of the renderers view.

height number 600 optional

The height of the renderers view.

view HTMLCanvasElement optional

The canvas to use as a view, optional.

transparent boolean false optional

If the render view is transparent.

autoDensity boolean false optional

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

antialias boolean false optional

Sets antialias

preserveDrawingBuffer boolean false optional

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

resolution number 1 optional

The resolution / device pixel ratio of the renderer, retina would be 2.

forceCanvas boolean false 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.

backgroundColor number 0x000000 optional

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

clearBeforeRender boolean true optional

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

powerPreference string optional

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

sharedTicker boolean false 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.

sharedLoader boolean false optional

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

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) static

Register a middleware plugin for the application

Name Type Description
plugin PIXI.Application.Plugin

Plugin being installed

destroy (removeView, stageOptions)

Destroy and don't use after this.

Name Type Default Description
removeView Boolean false 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

Name Type Default Description
children boolean false optional

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

texture boolean false optional

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

baseTexture boolean false optional

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

queueResize ()

Resize is throttled, so it's safe to call this multiple times per frame and it'll only be called once.

render ()

Render the current stage.

resize ()

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.

Type Definitions

PIXI.Application.Plugin object

Name Type Description
init function

Called when Application is constructed, scoped to Application instance. Passes in options as the only argument, which are Application constructor options.

destroy function

Called when destroying Application, scoped to Application instance