LogoPixi’VN
pixi-jsInterfaces

Interface: CanvasOptions

Defined in: node_modules/pixi.js/lib/rendering/renderers/canvas/CanvasRenderer.d.ts:37

Options for CanvasRenderer.

Standard

Extends

Extended by

Properties

antialias?

> optional antialias?: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:42

Whether to enable anti-aliasing. This may affect performance.

Inherited from

SharedRendererOptions.antialias


autoDensity?

> optional autoDensity?: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:38

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

This is only supported for HTMLCanvasElement and will be ignored if the canvas is an OffscreenCanvas.

Inherited from

SharedRendererOptions.autoDensity


background?

> optional background?: ColorSource

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/background/BackgroundSystem.d.ts:17

Alias for backgroundColor

Inherited from

SharedRendererOptions.background


backgroundAlpha?

> optional backgroundAlpha?: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/background/BackgroundSystem.d.ts:25

Transparency of the background color, value from 0 (fully transparent) to 1 (fully opaque). This value determines whether the canvas is initialized with alpha transparency support. Note: This cannot be changed after initialization. If set to 1, the canvas will remain opaque, even if a transparent background color is set later.

Default

1

Inherited from

SharedRendererOptions.backgroundAlpha


backgroundColor

> backgroundColor: ColorSource

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/background/BackgroundSystem.d.ts:15

The background color used to clear the canvas. See ColorSource for accepted color values.

Default

'black'

Inherited from

SharedRendererOptions.backgroundColor


bezierSmoothness

> bezierSmoothness: number

Defined in: node_modules/pixi.js/lib/scene/graphics/GraphicsMixins.d.ts:35

A value from 0 to 1 that controls the smoothness of bezier curves (the higher the smoother)

Default

0.5

Inherited from

SharedRendererOptions.bezierSmoothness


canvas?

> optional canvas?: ICanvas

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:26

The canvas to use as a view, optional.

Inherited from

SharedRendererOptions.canvas


clearBeforeRender?

> optional clearBeforeRender?: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/background/BackgroundSystem.d.ts:30

Whether to clear the canvas before new render passes.

Default

true

Inherited from

SharedRendererOptions.clearBeforeRender


depth?

> optional depth?: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:44

Whether to ensure the main view has can make use of the depth buffer. Always true for WebGL renderer.

Inherited from

SharedRendererOptions.depth


eventFeatures?

> optional eventFeatures?: Partial<EventSystemFeatures>

Defined in: node_modules/pixi.js/lib/events/EventsMixins.d.ts:73

Configuration for enabling/disabling specific event features. Use this to optimize performance by turning off unused functionality.

Example

const app = new Application();
await app.init({
    eventFeatures: {
        // Core interaction events
        move: true,        // Pointer/mouse/touch movement
        click: true,       // Click/tap events
        wheel: true,       // Mouse wheel/scroll events
        // Global tracking
        globalMove: false  // Global pointer movement
    }
});

Since

7.2.0

Inherited from

SharedRendererOptions.eventFeatures


eventMode?

> optional eventMode?: EventMode

Defined in: node_modules/pixi.js/lib/events/EventsMixins.d.ts:53

The type of interaction behavior for a Container. This is set via the Container#eventMode property.

Example

// Basic event mode setup
const sprite = new Sprite(texture);
sprite.eventMode = 'static';    // Enable standard interaction
sprite.on('pointerdown', () => { console.log('clicked!'); });

// Different event modes
sprite.eventMode = 'none';      // Disable all interaction
sprite.eventMode = 'passive';   // Only allow interaction on children
sprite.eventMode = 'auto';      // Like DOM pointer-events: auto
sprite.eventMode = 'dynamic';   // For moving/animated objects

Available modes:

  • 'none': Ignores all interaction events, even on its children
  • 'passive': (default) Does not emit events and ignores hit testing on itself and non-interactive children. Interactive children will still emit events.
  • 'auto': Does not emit events but is hit tested if parent is interactive. Same as interactive = false in v7
  • 'static': Emit events and is hit tested. Same as interactive = true in v7
  • 'dynamic': Emits events and is hit tested but will also receive mock interaction events fired from a ticker to allow for interaction when the mouse isn't moving

Performance tips:

  • Use 'none' for pure visual elements
  • Use 'passive' for containers with some interactive children
  • Use 'static' for standard buttons/controls
  • Use 'dynamic' only for moving/animated interactive elements

Since

7.2.0

Inherited from

SharedRendererOptions.eventMode


failIfMajorPerformanceCaveat?

> optional failIfMajorPerformanceCaveat?: boolean

Defined in: node_modules/pixi.js/lib/rendering/RenderingMixins.d.ts:15

Inherited from

SharedRendererOptions.failIfMajorPerformanceCaveat


gcActive

> gcActive: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/GCSystem.d.ts:50

If set to true, this will enable the garbage collector.

Default

true

Inherited from

SharedRendererOptions.gcActive


gcFrequency

> gcFrequency: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/GCSystem.d.ts:60

How frequently to run garbage collection in milliseconds.

Default

30000

Inherited from

SharedRendererOptions.gcFrequency


gcMaxUnusedTime

> gcMaxUnusedTime: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/GCSystem.d.ts:55

The maximum time in milliseconds a resource can be unused before being garbage collected.

Default

60000

Inherited from

SharedRendererOptions.gcMaxUnusedTime


height?

> optional height?: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:24

The height of the screen.

Default

600

Inherited from

SharedRendererOptions.height


hello

> hello: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/startup/HelloSystem.d.ts:15

Whether to log the version and type information of renderer to console.

Default

false

Inherited from

SharedRendererOptions.hello


~~manageImports?~~

> optional manageImports?: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/system/SharedSystems.d.ts:73

Default

true

Deprecated

since 8.1.6

See

skipExtensionImports

Inherited from

SharedRendererOptions.manageImports


renderableGCActive

> renderableGCActive: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/RenderableGCSystem.d.ts:20

If set to true, this will enable the garbage collector on the GPU.

Default

true

Inherited from

SharedRendererOptions.renderableGCActive


renderableGCFrequency

> renderableGCFrequency: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/RenderableGCSystem.d.ts:30

Frames between two garbage collections.

Default

600

Inherited from

SharedRendererOptions.renderableGCFrequency


renderableGCMaxUnusedTime

> renderableGCMaxUnusedTime: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/RenderableGCSystem.d.ts:25

The maximum idle frames before a texture is destroyed by garbage collection.

Default

60 * 60

Inherited from

SharedRendererOptions.renderableGCMaxUnusedTime


resolution?

> optional resolution?: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:40

The resolution / device pixel ratio of the renderer.

Inherited from

SharedRendererOptions.resolution


roundPixels?

> optional roundPixels?: boolean

Defined in: node_modules/pixi.js/lib/rendering/RenderingMixins.d.ts:16

Inherited from

SharedRendererOptions.roundPixels


skipExtensionImports?

> optional skipExtensionImports?: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/system/SharedSystems.d.ts:67

Whether to stop PixiJS from dynamically importing default extensions for the renderer. It is false by default, and means PixiJS will load all the default extensions, based on the environment e.g browser/webworker. If you set this to true, then you will need to manually import the systems and extensions you need.

e.g.

import 'accessibility';
import 'app';
import 'events';
import 'spritesheet';
import 'graphics';
import 'mesh';
import 'text';
import 'text-bitmap';
import 'text-html';
import { autoDetectRenderer } from 'pixi.js';

const renderer = await autoDetectRenderer({
  width: 800,
  height: 600,
  skipExtensionImports: true,
});

Default

false

Inherited from

SharedRendererOptions.skipExtensionImports


~~textureGCActive~~

> textureGCActive: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TextureGCSystem.d.ts:17

If set to true, this will enable the garbage collector on the GPU.

Default

true

Deprecated

since 8.15.0

Inherited from

SharedRendererOptions.textureGCActive


~~textureGCAMaxIdle~~

> textureGCAMaxIdle: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TextureGCSystem.d.ts:22

Deprecated

since 8.3.0

See

TextureGCSystemOptions.textureGCMaxIdle

Inherited from

SharedRendererOptions.textureGCAMaxIdle


~~textureGCCheckCountMax~~

> textureGCCheckCountMax: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TextureGCSystem.d.ts:34

Frames between two garbage collections.

Default

600

Deprecated

since 8.15.0

Inherited from

SharedRendererOptions.textureGCCheckCountMax


~~textureGCMaxIdle~~

> textureGCMaxIdle: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TextureGCSystem.d.ts:28

The maximum idle frames before a texture is destroyed by garbage collection.

Default

60 * 60

Deprecated

since 8.15.0

Inherited from

SharedRendererOptions.textureGCMaxIdle


~~view?~~

> optional view?: ICanvas

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:31

Alias for canvas.

Deprecated

since 8.0.0

Inherited from

SharedRendererOptions.view


width?

> optional width?: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/view/ViewSystem.d.ts:19

The width of the screen.

Default

800

Inherited from

SharedRendererOptions.width