The renderer instance that handles all drawing operations.
Unless specified, it will automatically create a WebGL renderer if available.
If WebGPU is available and the preference
is set to webgpu
, it will create a WebGPU renderer.
Element to automatically resize the renderer to.
The root display container for your application. All visual elements should be added to this container or its children.
The application's ticker instance that manages the update/render loop.
// Basic animation
app.ticker.add((ticker) => {
sprite.rotation += 0.1 * ticker.deltaTime;
});
// Control update priority
app.ticker.add(
(ticker) => {
// Physics update (runs first)
},
undefined,
UPDATE_PRIORITY.HIGH
);
// One-time update
app.ticker.addOnce(() => {
console.log('Runs next frame only');
});
// Access timing info
console.log(app.ticker.FPS); // Current FPS
console.log(app.ticker.deltaTime); // Scaled time delta
console.log(app.ticker.deltaMS); // MS since last update
Reference to the renderer's canvas element. This is the HTML element that displays your application's graphics.
Reference to the renderer's screen rectangle. This represents the visible area of your application.
It's commonly used for:
// Use as filter area for a full-screen effect
const blurFilter = new BlurFilter();
sprite.filterArea = app.screen;
// Use as hit area for screen-wide interaction
const screenSprite = new Sprite();
screenSprite.hitArea = app.screen;
// Get screen dimensions
console.log(app.screen.width, app.screen.height);
Rectangle For all available properties and methods
Destroys the application and all of its resources.
This method should be called when you want to completely clean up the application and free all associated memory.
Options for destroying the renderer:
false
or undefined
: Preserves the canvas element (default)true
: Removes the canvas element{ removeView: boolean }
: Object with removeView property to control canvas removalOptions for destroying the application:
false
or undefined
: Basic cleanup (default)true
: Complete cleanup including childrenchildren
: Remove childrentexture
: Destroy texturestextureSource
: Destroy texture sourcescontext
: Destroy WebGL context// Basic cleanup
app.destroy();
// Remove canvas and do complete cleanup
app.destroy(true, true);
// Remove canvas with explicit options
app.destroy({ removeView: true }, true);
// Detailed cleanup with specific options
app.destroy(
{ removeView: true },
{
children: true,
texture: true,
textureSource: true,
context: true
}
);
After calling destroy, the application instance should no longer be used. All properties will be null and further operations will throw errors.
Initializes the PixiJS application with the specified options.
This method must be called after creating a new Application instance.
Optional
options: Partial<ApplicationOptions>Configuration options for the application and renderer
A promise that resolves when initialization is complete
Queue a resize operation for the next animation frame. This method is throttled and optimized for frequent calls.
You do not need to call this method manually in most cases.
A resize
event will be dispatched automatically when the resizeTo
element changes size.
Renders the current stage to the screen.
When using the default setup with TickerPlugin (enabled by default), you typically don't need to call this method directly as rendering is handled automatically.
Only use this method if you've disabled the TickerPlugin or need custom render timing control.
// Example 1: Default setup (TickerPlugin handles rendering)
const app = new Application();
await app.init();
// No need to call render() - TickerPlugin handles it
// Example 2: Custom rendering loop (if TickerPlugin is disabled)
const app = new Application();
await app.init({ autoStart: false }); // Disable automatic rendering
function animate() {
app.render();
requestAnimationFrame(animate);
}
animate();
Element to automatically resize the renderer to.
You do not need to call this method manually in most cases.
A resize
event will be dispatched automatically when the resizeTo
element changes size.
resizeTo
elementresizeTo
is null
, auto-resizing is disabledresizeTo
is a Window
, it resizes to the full window sizeresizeTo
is an HTMLElement
, it resizes to the element's bounding client rectangle
Convenience class to create a new PixiJS application.
The Application class is the main entry point for creating a PixiJS application. It handles the setup of all core components needed to start rendering and managing your game or interactive experience.
Key features:
Example
From PixiJS v8.0.0, the application must be initialized using the async
init()
method rather than passing options to the constructor.See