Class: Application

PIXI. 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
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

legacy boolean false optional

If true Pixi will aim to ensure compatibility with older / less advanced devices. If you experience unexplained flickering try setting this to true.

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.

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

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

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

Members

protected_optionsobject

The default options, so we mixin functionality later.

Loader instance to help with asset loading.

WebGL renderer if available, otherwise CanvasRenderer

readonlyscreenPIXI.Rectangle

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

readonlyviewHTMLCanvasElement

Reference to the renderer's canvas element.

Methods

destroy(removeView)

Destroy and don't use after this.

Name Type Default Description
removeView Boolean false optional

Automatically remove canvas from DOM.

Render the current stage.

Convenience method for starting the render.

Convenience method for stopping the render.