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(width, height, options, noWebGL)

Name Type Default Description
width number 800 optional

the width of the renderers view

height number 600 optional

the height of the renderers view

options object optional

The optional renderer parameters

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

noWebGL boolean false optional

prevents selection of WebGL renderer, even if such is present

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

WebGL renderer if available, otherwise CanvasRenderer

The root display container that's renderered.

Ticker for doing render updates.

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.