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 that 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, default false

antialias boolean false optional

sets antialias (only applicable in chrome at the moment)

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

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.

roundPixels boolean false optional

If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.

forceFXAA boolean false optional

forces FXAA antialiasing to be used over native. FXAA is faster, but may not always look as great webgl only

legacy boolean false optional

true to ensure compatibility with older / less advanced devices. If you experience unexplained flickering try setting this to true. webgl only

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.

sharedLoader boolean false optional

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

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

// Add the view to the DOM

// ex, add display objects


_options object protected

The default options, so we mixin functionality later.

Loader instance to help with asset loading.

WebGL renderer if available, otherwise CanvasRenderer

screen PIXI.Rectangle readonly

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

The root display container that's rendered.

Ticker for doing render updates.

Default Value:
  • PIXI.ticker.shared

view HTMLCanvasElement readonly

Reference to the renderer's canvas element.


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

render ()

Render the current stage.

Convenience method for starting the render.

Convenience method for stopping the render.