NineSliceSprite
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:160
The NineSliceSprite allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically
A B
+---+----------------------+---+
C | 1 | 2 | 3 |
+---+----------------------+---+
| | | |
| 4 | 5 | 6 |
| | | |
+---+----------------------+---+
D | 7 | 8 | 9 |
+---+----------------------+---+
When changing this objects width and/or height:
areas 1 3 7 and 9 will remain unscaled.
areas 2 and 8 will be stretched horizontally
areas 4 and 6 will be stretched vertically
area 5 will be stretched both horizontally and vertically
Example
Section titled “Example”import { NineSliceSprite, Texture } from 'pixi.js';
const plane9 = new NineSliceSprite({ texture: Texture.from('BoxWithRoundedCorners.png'), leftWidth: 15, topHeight: 15, rightWidth: 15, bottomHeight: 15, width: 200, height: 100,});Standard
Section titled “Standard”Extends
Section titled “Extends”NineSliceSprite.ViewContainer<NineSliceSpriteGpuData>
Implements
Section titled “Implements”View
Properties
Section titled “Properties”_anchor
Section titled “_anchor”_anchor:
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:225
Internal
_bounds
Section titled “_bounds”
protected_bounds:Bounds
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:59
Inherited from
Section titled “Inherited from”ViewContainer._bounds
_boundsDirty
Section titled “_boundsDirty”
protected_boundsDirty:boolean
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:60
Inherited from
Section titled “Inherited from”ViewContainer._boundsDirty
_cx:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:751
Internal
The X-coordinate value of the normalized local X axis, the first column of the local transformation matrix without a scale.
Inherited from
Section titled “Inherited from”ViewContainer._cx
_cy:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:763
Internal
The X-coordinate value of the normalized local Y axis, the second column of the local transformation matrix without a scale.
Inherited from
Section titled “Inherited from”ViewContainer._cy
_gcData?
Section titled “_gcData?”
optional_gcData?:GCData
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:54
Internal
Inherited from
Section titled “Inherited from”ViewContainer._gcData
_gcLastUsed
Section titled “_gcLastUsed”_gcLastUsed:
number
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:58
Internal
Inherited from
Section titled “Inherited from”ViewContainer._gcLastUsed
_gpuData
Section titled “_gpuData”_gpuData:
Record<number,GPU_DATA>
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:52
Internal
Inherited from
Section titled “Inherited from”ViewContainer._gpuData
_lastUsed
Section titled “_lastUsed”_lastUsed:
number
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:50
Internal
Inherited from
Section titled “Inherited from”ViewContainer._lastUsed
_pivot
Section titled “_pivot”_pivot:
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:734
Internal
The pivot point of the container that it rotates around.
Inherited from
Section titled “Inherited from”ViewContainer._pivot
_position
Section titled “_position”_position:
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:724
Internal
The coordinate of the object relative to the local coordinates of the parent.
Inherited from
Section titled “Inherited from”ViewContainer._position
_roundPixels
Section titled “_roundPixels”_roundPixels:
0|1
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:48
Internal
Inherited from
Section titled “Inherited from”ViewContainer._roundPixels
_scale
Section titled “_scale”_scale:
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:729
Internal
The scale factor of the object.
Inherited from
Section titled “Inherited from”ViewContainer._scale
_skew:
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:745
Internal
The skew amount, on the x and y axis.
Inherited from
Section titled “Inherited from”ViewContainer._skew
_sx:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:757
Internal
The Y-coordinate value of the normalized local X axis, the first column of the local transformation matrix without a scale.
Inherited from
Section titled “Inherited from”ViewContainer._sx
_sy:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:769
Internal
The Y-coordinate value of the normalized local Y axis, the second column of the local transformation matrix without a scale.
Inherited from
Section titled “Inherited from”ViewContainer._sy
_texture
Section titled “_texture”_texture:
Texture
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:223
Internal
_zIndex
Section titled “_zIndex”_zIndex:
number
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts:60
Internal
Inherited from
Section titled “Inherited from”ViewContainer._zIndex
accessible?
Section titled “accessible?”
optionalaccessible?:boolean
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:31
Flag for if the object is accessible. If true AccessibilityManager will overlay a shadow div with attributes set
Default
Section titled “Default”falseExample
Section titled “Example”const container = new Container();container.accessible = true;Inherited from
Section titled “Inherited from”ViewContainer.accessible
accessibleChildren?
Section titled “accessibleChildren?”
optionalaccessibleChildren?:boolean
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:126
Setting to false will prevent any children inside this container to be accessible. Defaults to true.
Default
Section titled “Default”trueExample
Section titled “Example”const container = new Container();container.accessible = true;container.accessibleChildren = false; // This will prevent any children from being accessible
const sprite = new Sprite(texture);sprite.accessible = true; // This will not work since accessibleChildren is falseInherited from
Section titled “Inherited from”ViewContainer.accessibleChildren
accessibleHint?
Section titled “accessibleHint?”
optionalaccessibleHint?:string|null
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:56
Sets the aria-label attribute of the shadow div
Default
Section titled “Default”nullAdvanced
Section titled “Advanced”Example
Section titled “Example”const container = new Container();container.accessible = true;container.accessibleHint = 'This is a container';Inherited from
Section titled “Inherited from”ViewContainer.accessibleHint
accessiblePointerEvents?
Section titled “accessiblePointerEvents?”
optionalaccessiblePointerEvents?:PointerEvents
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:100
Specify the pointer-events the accessible div will use Defaults to auto.
Default
Section titled “Default”'auto'Advanced
Section titled “Advanced”Example
Section titled “Example”const container = new Container();container.accessible = true;container.accessiblePointerEvents = 'none'; // or 'auto', 'visiblePainted', etc.Inherited from
Section titled “Inherited from”ViewContainer.accessiblePointerEvents
accessibleText?
Section titled “accessibleText?”
optionalaccessibleText?:string|null
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:111
Sets the text content of the shadow
Default
Section titled “Default”nullExample
Section titled “Example”const container = new Container();container.accessible = true;container.accessibleText = 'This is a container';Inherited from
Section titled “Inherited from”ViewContainer.accessibleText
accessibleTitle?
Section titled “accessibleTitle?”
optionalaccessibleTitle?:string|null
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:44
Sets the title attribute of the shadow div If accessibleTitle AND accessibleHint has not been this will default to ‘container [tabIndex]‘
Default
Section titled “Default”nullExample
Section titled “Example”const container = new Container();container.accessible = true;container.accessibleTitle = 'My Container';Inherited from
Section titled “Inherited from”ViewContainer.accessibleTitle
accessibleType?
Section titled “accessibleType?”
optionalaccessibleType?: keyof HTMLElementTagNameMap
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:86
Specify the type of div the accessible layer is. Screen readers treat the element differently depending on this type. Defaults to button.
Default
Section titled “Default”'button'Advanced
Section titled “Advanced”Example
Section titled “Example”const container = new Container();container.accessible = true;container.accessibleType = 'button'; // or 'link', 'checkbox', etc.Inherited from
Section titled “Inherited from”ViewContainer.accessibleType
allowChildren
Section titled “allowChildren”allowChildren:
boolean
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:46
Internal
Inherited from
Section titled “Inherited from”ViewContainer.allowChildren
autoGarbageCollect
Section titled “autoGarbageCollect”autoGarbageCollect:
boolean
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:56
If set to true, the resource will be garbage collected automatically when it is not used.
Inherited from
Section titled “Inherited from”ViewContainer.autoGarbageCollect
batched
Section titled “batched”batched:
boolean
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:227
Internal
Inherited from
Section titled “Inherited from”ViewContainer.batched
boundsArea
Section titled “boundsArea”boundsArea:
Rectangle
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:815
An optional bounds area for this container. Setting this rectangle will stop the renderer from recursively measuring the bounds of each children and instead use this single boundArea.
[!IMPORTANT] This is great for optimisation! If for example you have a 1000 spinning particles and you know they all sit within a specific bounds, then setting it will mean the renderer will not need to measure the 1000 children to find the bounds. Instead it will just use the bounds you set.
Example
Section titled “Example”const container = new Container();container.boundsArea = new Rectangle(0, 0, 500, 500);Inherited from
Section titled “Inherited from”ViewContainer.boundsArea
cacheAsBitmap
Section titled “cacheAsBitmap”cacheAsBitmap:
boolean
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/cacheAsTextureMixin.d.ts:61
Legacy property for backwards compatibility with PixiJS v7 and below.
Use cacheAsTexture instead.
Inherited from
Section titled “Inherited from”ViewContainer.cacheAsBitmap
cacheAsTexture
Section titled “cacheAsTexture”cacheAsTexture: (
val) =>void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/cacheAsTextureMixin.d.ts:45
Caches this container as a texture. This allows the container to be rendered as a single texture, which can improve performance for complex static containers.
Parameters
Section titled “Parameters”boolean | CacheAsTextureOptions
If true, enables caching with default options. If false, disables caching. Can also pass options object to configure caching behavior.
Returns
Section titled “Returns”void
Example
Section titled “Example”// Basic cachingcontainer.cacheAsTexture(true);
// With custom optionscontainer.cacheAsTexture({ resolution: 2, antialias: true,});
// Disable cachingcontainer.cacheAsTexture(false);
// Cache a complex UIconst ui = new Container();// Add multiple children...ui.cacheAsTexture(true);ui.updateCacheTexture(); // Update if contents change- Container#updateCacheTexture For updating cached content
- Container#isCachedAsTexture For checking cache state
Inherited from
Section titled “Inherited from”ViewContainer.cacheAsTexture
canBundle
Section titled “canBundle”
readonlycanBundle:true=true
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:44
Internal
Inherited from
Section titled “Inherited from”ViewContainer.canBundle
children
Section titled “children”
readonlychildren:ContainerChild[]
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:639
The array of children of this container. Each child must be a Container or extend from it.
The array is read-only, but its contents can be modified using Container methods.
Example
Section titled “Example”// Access childrenconst firstChild = container.children[0];const lastChild = container.children[container.children.length - 1];- Container#addChild For adding children
- Container#removeChild For removing children
Inherited from
Section titled “Inherited from”ViewContainer.children
cullable?
Section titled “cullable?”
optionalcullable?:boolean
Defined in: node_modules/pixi.js/lib/culling/cullingMixin.d.ts:69
Controls whether this object should be culled when out of view. When true, the object will not be rendered if its bounds are outside the visible area.
Example
Section titled “Example”const sprite = new Sprite(texture);
// Enable cullingsprite.cullable = true;
// Force object to always rendersprite.cullable = false;Remarks
Section titled “Remarks”- Does not affect transform updates
- Applies to this object only
- Children follow their own cullable setting
Default
Section titled “Default”falseInherited from
Section titled “Inherited from”ViewContainer.cullable
cullableChildren?
Section titled “cullableChildren?”
optionalcullableChildren?:boolean
Defined in: node_modules/pixi.js/lib/culling/cullingMixin.d.ts:92
Controls whether children of this container can be culled. When false, skips recursive culling checks for better performance.
Example
Section titled “Example”const container = new Container();
// Enable container cullingcontainer.cullable = true;
// Disable child culling for performancecontainer.cullableChildren = false;
// Children will always render if container is visiblecontainer.addChild(sprite1, sprite2, sprite3);Remarks
Section titled “Remarks”- Improves performance for static scenes
- Useful when children are always within container bounds
- Parent culling still applies
Default
Section titled “Default”trueInherited from
Section titled “Inherited from”ViewContainer.cullableChildren
cullArea?
Section titled “cullArea?”
optionalcullArea?:Rectangle
Defined in: node_modules/pixi.js/lib/culling/cullingMixin.d.ts:49
Custom shape used for culling calculations instead of object bounds. Defined in local space coordinates relative to the object.
[!NOTE] Setting this to a custom Rectangle allows you to define a specific area for culling, which can improve performance by avoiding expensive bounds calculations.
Example
Section titled “Example”const container = new Container();
// Define custom culling boundarycontainer.cullArea = new Rectangle(0, 0, 800, 600);
// Reset to use object boundscontainer.cullArea = null;Remarks
Section titled “Remarks”- Improves performance by avoiding bounds calculations
- Useful for containers with many children
- Set to null to use object bounds
Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.cullArea
cursor?
Section titled “cursor?”
optionalcursor?:string&object|Cursor
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:187
The cursor style to display when the mouse pointer is hovering over the object. Accepts any valid CSS cursor value or custom cursor URL.
Example
Section titled “Example”// Common cursor typessprite.cursor = 'pointer'; // Hand cursor for clickable elementssprite.cursor = 'grab'; // Grab cursor for draggable elementssprite.cursor = 'crosshair'; // Precise cursor for selectionsprite.cursor = 'not-allowed'; // Indicate disabled state
// Direction cursorssprite.cursor = 'n-resize'; // North resizesprite.cursor = 'ew-resize'; // East-west resizesprite.cursor = 'nesw-resize'; // Northeast-southwest resize
// Custom cursor with fallbacksprite.cursor = 'url("custom.png"), auto';sprite.cursor = 'url("cursor.cur") 2 2, pointer'; // With hotspot offsetDefault
Section titled “Default”undefined- EventSystem.cursorStyles For setting global cursor styles
- https://developer.mozilla.org/en-US/docs/Web/CSS/cursor MDN Cursor Documentation
Inherited from
Section titled “Inherited from”ViewContainer.cursor
depthOfChildModified
Section titled “depthOfChildModified”depthOfChildModified: () =>
void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts:74
Internal
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.depthOfChildModified
destroyed
Section titled “destroyed”destroyed:
boolean
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:719
Whether this object has been destroyed. If true, the object should no longer be used. After an object is destroyed, all of its functionality is disabled and references are removed.
Example
Section titled “Example”// Cleanup with destroysprite.destroy();console.log(sprite.destroyed); // trueDefault
Section titled “Default”falseContainer#destroy For destroying objects
Inherited from
Section titled “Inherited from”ViewContainer.destroyed
effects?
Section titled “effects?”
optionaleffects?:Effect[]
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:168
todo Needs docs
Advanced
Section titled “Advanced”Inherited from
Section titled “Inherited from”ViewContainer.effects
eventMode?
Section titled “eventMode?”
optionaleventMode?:EventMode
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:225
Enable interaction events for the Container. Touch, pointer and mouse events are supported.
Example
Section titled “Example”const sprite = new Sprite(texture);
// Enable standard interaction (like buttons)sprite.eventMode = 'static';sprite.on('pointerdown', () => console.log('clicked!'));
// Enable for moving objectssprite.eventMode = 'dynamic';sprite.on('pointermove', () => updatePosition());
// Disable all interactionsprite.eventMode = 'none';
// Only allow child interactionssprite.eventMode = 'passive';Available modes:
'none': Ignores all interaction events, even on its children. Best for pure visuals.'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 asinteractive = falsein v7.'static': Emit events and is hit tested. Same asinteractive = truein v7. Best for buttons/UI.'dynamic': Like static but also receives synthetic events when pointer is idle. Best for moving objects.
Performance tips:
- Use
'none'for pure visual elements - Use
'passive'for containers with some interactive children - Use
'static'for standard UI elements - Use
'dynamic'only when needed for moving/animated elements
7.2.0
Inherited from
Section titled “Inherited from”ViewContainer.eventMode
filterArea?
Section titled “filterArea?”
optionalfilterArea?:Rectangle
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:163
The area the filter is applied to. This is used as an optimization to define a specific region for filter effects instead of calculating the display object bounds each frame.
[!NOTE] Setting this to a custom Rectangle allows you to define a specific area for filter effects, which can improve performance by avoiding expensive bounds calculations.
Example
Section titled “Example”// Set specific filter areacontainer.filterArea = new Rectangle(0, 0, 100, 100);
// Optimize filter regionconst screen = app.screen;container.filterArea = new Rectangle( screen.x, screen.y, screen.width, screen.height);- Container#filters For applying filters
- Rectangle For area definition
Inherited from
Section titled “Inherited from”ViewContainer.filterArea
globalDisplayStatus
Section titled “globalDisplayStatus”globalDisplayStatus:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:798
Internal
Inherited from
Section titled “Inherited from”ViewContainer.globalDisplayStatus
groupAlpha
Section titled “groupAlpha”groupAlpha:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:780
Internal
Inherited from
Section titled “Inherited from”ViewContainer.groupAlpha
groupBlendMode
Section titled “groupBlendMode”groupBlendMode:
BLEND_MODES
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:788
Internal
Inherited from
Section titled “Inherited from”ViewContainer.groupBlendMode
groupColor
Section titled “groupColor”groupColor:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:782
Internal
Inherited from
Section titled “Inherited from”ViewContainer.groupColor
groupColorAlpha
Section titled “groupColorAlpha”groupColorAlpha:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:784
Internal
Inherited from
Section titled “Inherited from”ViewContainer.groupColorAlpha
groupTransform
Section titled “groupTransform”
readonlygroupTransform:Matrix
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:705
The group transform is a transform relative to the render group it belongs too. If this container is render group then this will be an identity matrix. other wise it will be the same as the relativeGroupTransform. Use this value when actually rendering things to the screen
Advanced
Section titled “Advanced”Inherited from
Section titled “Inherited from”ViewContainer.groupTransform
hitArea?
Section titled “hitArea?”
optionalhitArea?:IHitArea|null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:297
Defines a custom hit area for pointer interaction testing. When set, this shape will be used for hit testing instead of the container’s standard bounds.
Example
Section titled “Example”import { Rectangle, Circle, Sprite } from 'pixi.js';
// Rectangular hit areaconst button = new Sprite(texture);button.eventMode = 'static';button.hitArea = new Rectangle(0, 0, 100, 50);
// Circular hit areaconst icon = new Sprite(texture);icon.eventMode = 'static';icon.hitArea = new Circle(32, 32, 32);
// Custom hit area with polygonconst custom = new Sprite(texture);custom.eventMode = 'static';custom.hitArea = new Polygon([0,0, 100,0, 100,100, 0,100]);
// Custom hit testing logicsprite.hitArea = { contains(x: number, y: number) { // Custom collision detection return x >= 0 && x <= width && y >= 0 && y <= height; }};Remarks
Section titled “Remarks”- Takes precedence over the container’s bounds for hit testing
- Can improve performance by simplifying collision checks
- Useful for irregular shapes or precise click areas
Inherited from
Section titled “Inherited from”ViewContainer.hitArea
interactive?
Section titled “interactive?”
optionalinteractive?:boolean
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:238
Whether this object should fire UI events. This is an alias for eventMode set to 'static' or 'passive'.
Setting this to true will enable interaction events like pointerdown, click, etc.
Setting it to false will disable all interaction events on this object.
Example
Section titled “Example”// Enable interaction eventssprite.interactive = true; // Sets eventMode = 'static'sprite.interactive = false; // Sets eventMode = 'passive'Inherited from
Section titled “Inherited from”ViewContainer.interactive
interactiveChildren?
Section titled “interactiveChildren?”
optionalinteractiveChildren?:boolean
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:261
Controls whether children of this container can receive pointer events.
Setting this to false allows PixiJS to skip hit testing on all children, improving performance for containers with many non-interactive children.
Default
Section titled “Default”trueExample
Section titled “Example”// Container with many visual-only childrenconst container = new Container();container.interactiveChildren = false; // Skip hit testing children
// Menu with interactive buttonsconst menu = new Container();menu.interactiveChildren = true; // Test all childrenmenu.addChild(button1, button2, button3);
// Performance optimizationbackground.interactiveChildren = false;foreground.interactiveChildren = true;Inherited from
Section titled “Inherited from”ViewContainer.interactiveChildren
isCachedAsTexture
Section titled “isCachedAsTexture”
readonlyisCachedAsTexture:boolean
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/cacheAsTextureMixin.d.ts:75
Whether this container is currently cached as a texture.
Example
Section titled “Example”// Check cache stateif (container.isCachedAsTexture) { console.log('Container is cached');}- Container#cacheAsTexture For enabling caching
- Container#updateCacheTexture For updating cache
Inherited from
Section titled “Inherited from”ViewContainer.isCachedAsTexture
isInteractive
Section titled “isInteractive”isInteractive: () =>
boolean
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:1040
Determines if the container is interactive or not
Returns
Section titled “Returns”boolean
Whether the container is interactive or not
7.2.0
Example
Section titled “Example”import { Sprite } from 'pixi.js';
const sprite = new Sprite(texture);sprite.eventMode = 'static';sprite.isInteractive(); // true
sprite.eventMode = 'dynamic';sprite.isInteractive(); // true
sprite.eventMode = 'none';sprite.isInteractive(); // false
sprite.eventMode = 'passive';sprite.isInteractive(); // false
sprite.eventMode = 'auto';sprite.isInteractive(); // falseInherited from
Section titled “Inherited from”ViewContainer.isInteractive
label:
string
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.d.ts:8
The instance label of the object.
Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.label
layerParentId
Section titled “layerParentId”layerParentId:
string
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:829
Internal
Inherited from
Section titled “Inherited from”ViewContainer.layerParentId
localAlpha
Section titled “localAlpha”localAlpha:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:778
Internal
Inherited from
Section titled “Inherited from”ViewContainer.localAlpha
localBlendMode
Section titled “localBlendMode”localBlendMode:
BLEND_MODES
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:786
Internal
Inherited from
Section titled “Inherited from”ViewContainer.localBlendMode
localColor
Section titled “localColor”localColor:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:776
Internal
Inherited from
Section titled “Inherited from”ViewContainer.localColor
localDisplayStatus
Section titled “localDisplayStatus”localDisplayStatus:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:796
Internal
This property holds three bits: culled, visible, renderable the third bit represents culling (0 = culled, 1 = not culled) 0b100 the second bit represents visibility (0 = not visible, 1 = visible) 0b010 the first bit represents renderable (0 = not renderable, 1 = renderable) 0b001
Inherited from
Section titled “Inherited from”ViewContainer.localDisplayStatus
localTransform
Section titled “localTransform”
readonlylocalTransform:Matrix
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:688
Current transform of the object based on local factors: position, scale, other stuff. This matrix represents the local transformation without any parent influence.
Example
Section titled “Example”// Basic transform accessconst localMatrix = sprite.localTransform;console.log(localMatrix.toString());- Container#worldTransform For global transform
- Container#groupTransform For render group transform
Inherited from
Section titled “Inherited from”ViewContainer.localTransform
mask:
Mask
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:231
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it.
[!IMPORTANT] In PixiJS a regular mask must be a Graphics or a Sprite object. This allows for much faster masking in canvas as it utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent. Otherwise,
getLocalBoundsmay calculate incorrect bounds, which makes the container’s width and height wrong.
For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
Example
Section titled “Example”// Apply mask to spriteconst sprite = new Sprite(texture);sprite.mask = graphics;
// Remove masksprite.mask = null;- Graphics For creating mask shapes
- Sprite For texture-based masks
- Container#setMask For advanced mask options
Inherited from
Section titled “Inherited from”ViewContainer.mask
name:
string
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.d.ts:24
The instance name of the object.
Container#label
Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.name
onclick?
Section titled “onclick?”
optionalonclick?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:317
Property-based event handler for the click event.
Fired when a pointer device (mouse, touch, etc.) completes a click action.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('click', (event) => { console.log('Sprite clicked at:', event.global.x, event.global.y);});// Using property-based handlersprite.onclick = (event) => { console.log('Clicked at:', event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onclick
onglobalmousemove?
Section titled “onglobalmousemove?”
optionalonglobalmousemove?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:430
Property-based event handler for the globalmousemove event.
Fired when the mouse moves anywhere, regardless of whether the pointer is over this object.
The object must have eventMode set to ‘static’ or ‘dynamic’ to receive this event.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('globalmousemove', (event) => { // Move sprite to mouse position sprite.position.copyFrom(event.global);});// Using property-based handlersprite.onglobalmousemove = (event) => { // Move sprite to mouse position sprite.position.copyFrom(event.global);};Default
Section titled “Default”nullRemarks
Section titled “Remarks”- Fires even when the mouse is outside the object’s bounds
- Useful for drag operations or global mouse tracking
- Must have
eventModeset appropriately to receive events - Part of the global move events family along with
globalpointermoveandglobaltouchmove
Inherited from
Section titled “Inherited from”ViewContainer.onglobalmousemove
onglobalpointermove?
Section titled “onglobalpointermove?”
optionalonglobalpointermove?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:637
Property-based event handler for the globalpointermove event.
Fired when the pointer moves anywhere, regardless of whether the pointer is over this object.
The object must have eventMode set to ‘static’ or ‘dynamic’ to receive this event.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('globalpointermove', (event) => { sprite.position.set(event.global.x, event.global.y);});// Using property-based handlersprite.onglobalpointermove = (event) => { sprite.position.set(event.global.x, event.global.y);};Default
Section titled “Default”nullRemarks
Section titled “Remarks”- Fires even when the mouse is outside the object’s bounds
- Useful for drag operations or global mouse tracking
- Must have
eventModeset appropriately to receive events - Part of the global move events family along with
globalpointermoveandglobaltouchmove
Inherited from
Section titled “Inherited from”ViewContainer.onglobalpointermove
onglobaltouchmove?
Section titled “onglobaltouchmove?”
optionalonglobaltouchmove?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:947
Property-based event handler for the globaltouchmove event.
Fired when a touch interaction moves anywhere, regardless of whether the pointer is over this object.
The object must have eventMode set to ‘static’ or ‘dynamic’ to receive this event.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('globaltouchmove', (event) => { sprite.position.set(event.global.x, event.global.y);});// Using property-based handlersprite.onglobaltouchmove = (event) => { sprite.position.set(event.global.x, event.global.y);};Default
Section titled “Default”nullRemarks
Section titled “Remarks”- Fires even when the touch is outside the object’s bounds
- Useful for drag operations or global touch tracking
- Must have
eventModeset appropriately to receive events - Part of the global move events family along with
globalpointermoveandglobalmousemove
Inherited from
Section titled “Inherited from”ViewContainer.onglobaltouchmove
onmousedown?
Section titled “onmousedown?”
optionalonmousedown?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:339
Property-based event handler for the mousedown event.
Fired when a mouse button is pressed while the pointer is over the object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mousedown', (event) => { sprite.alpha = 0.5; // Visual feedback console.log('Mouse button:', event.button);});// Using property-based handlersprite.onmousedown = (event) => { sprite.alpha = 0.5; // Visual feedback console.log('Mouse button:', event.button);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmousedown
onmouseenter?
Section titled “onmouseenter?”
optionalonmouseenter?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:359
Property-based event handler for the mouseenter event.
Fired when the mouse pointer enters the bounds of the object. Does not bubble.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mouseenter', (event) => { sprite.scale.set(1.1);});// Using property-based handlersprite.onmouseenter = (event) => { sprite.scale.set(1.1);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmouseenter
onmouseleave?
Section titled “onmouseleave?”
optionalonmouseleave?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:379
Property-based event handler for the mouseleave event.
Fired when the pointer leaves the bounds of the display object. Does not bubble.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mouseleave', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onmouseleave = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmouseleave
onmousemove?
Section titled “onmousemove?”
optionalonmousemove?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:401
Property-based event handler for the mousemove event.
Fired when the pointer moves while over the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mousemove', (event) => { // Get coordinates relative to the sprite console.log('Local:', event.getLocalPosition(sprite));});// Using property-based handlersprite.onmousemove = (event) => { // Get coordinates relative to the sprite console.log('Local:', event.getLocalPosition(sprite));};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmousemove
onmouseout?
Section titled “onmouseout?”
optionalonmouseout?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:450
Property-based event handler for the mouseout event.
Fired when the pointer moves out of the bounds of the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mouseout', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onmouseout = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmouseout
onmouseover?
Section titled “onmouseover?”
optionalonmouseover?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:470
Property-based event handler for the mouseover event.
Fired when the pointer moves onto the bounds of the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mouseover', (event) => { sprite.scale.set(1.1);});// Using property-based handlersprite.onmouseover = (event) => { sprite.scale.set(1.1);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmouseover
onmouseup?
Section titled “onmouseup?”
optionalonmouseup?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:490
Property-based event handler for the mouseup event.
Fired when a mouse button is released over the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mouseup', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onmouseup = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmouseup
onmouseupoutside?
Section titled “onmouseupoutside?”
optionalonmouseupoutside?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:511
Property-based event handler for the mouseupoutside event.
Fired when a mouse button is released outside the display object that initially
registered a mousedown.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('mouseupoutside', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onmouseupoutside = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onmouseupoutside
onpointercancel?
Section titled “onpointercancel?”
optionalonpointercancel?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:531
Property-based event handler for the pointercancel event.
Fired when a pointer device interaction is canceled or lost.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointercancel', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onpointercancel = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointercancel
onpointerdown?
Section titled “onpointerdown?”
optionalonpointerdown?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:551
Property-based event handler for the pointerdown event.
Fired when a pointer device button (mouse, touch, pen, etc.) is pressed.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointerdown', (event) => { sprite.position.set(event.global.x, event.global.y);});// Using property-based handlersprite.onpointerdown = (event) => { sprite.position.set(event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointerdown
onpointerenter?
Section titled “onpointerenter?”
optionalonpointerenter?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:571
Property-based event handler for the pointerenter event.
Fired when a pointer device enters the bounds of the display object. Does not bubble.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointerenter', (event) => { sprite.scale.set(1.2);});// Using property-based handlersprite.onpointerenter = (event) => { sprite.scale.set(1.2);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointerenter
onpointerleave?
Section titled “onpointerleave?”
optionalonpointerleave?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:590
Property-based event handler for the pointerleave event.
Fired when a pointer device leaves the bounds of the display object. Does not bubble.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';// Using emitter handlersprite.on('pointerleave', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onpointerleave = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointerleave
onpointermove?
Section titled “onpointermove?”
optionalonpointermove?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:610
Property-based event handler for the pointermove event.
Fired when a pointer device moves while over the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointermove', (event) => { sprite.position.set(event.global.x, event.global.y);});// Using property-based handlersprite.onpointermove = (event) => { sprite.position.set(event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointermove
onpointerout?
Section titled “onpointerout?”
optionalonpointerout?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:657
Property-based event handler for the pointerout event.
Fired when the pointer moves out of the bounds of the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointerout', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onpointerout = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointerout
onpointerover?
Section titled “onpointerover?”
optionalonpointerover?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:677
Property-based event handler for the pointerover event.
Fired when the pointer moves over the bounds of the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointerover', (event) => { sprite.scale.set(1.2);});// Using property-based handlersprite.onpointerover = (event) => { sprite.scale.set(1.2);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointerover
onpointertap?
Section titled “onpointertap?”
optionalonpointertap?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:697
Property-based event handler for the pointertap event.
Fired when a pointer device completes a tap action (e.g., touch or mouse click).
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointertap', (event) => { console.log('Sprite tapped at:', event.global.x, event.global.y);});// Using property-based handlersprite.onpointertap = (event) => { console.log('Sprite tapped at:', event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointertap
onpointerup?
Section titled “onpointerup?”
optionalonpointerup?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:717
Property-based event handler for the pointerup event.
Fired when a pointer device button (mouse, touch, pen, etc.) is released.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointerup', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onpointerup = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointerup
onpointerupoutside?
Section titled “onpointerupoutside?”
optionalonpointerupoutside?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:738
Property-based event handler for the pointerupoutside event.
Fired when a pointer device button is released outside the bounds of the display object
that initially registered a pointerdown.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('pointerupoutside', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onpointerupoutside = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onpointerupoutside
onRender
Section titled “onRender”onRender: ((
renderer) =>void) |null
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.d.ts:25
This callback is used when the container is rendered. It runs every frame during the render process, making it ideal for per-frame updates and animations.
[!NOTE] In v7 many users used
updateTransformfor this, however the way v8 renders objects is different and “updateTransform” is no longer called every frame
Example
Section titled “Example”// Basic rotation animationconst container = new Container();container.onRender = () => { container.rotation += 0.01;};
// Cleanup when donecontainer.onRender = null; // Removes callbackThe renderer instance
Renderer For renderer capabilities
Inherited from
Section titled “Inherited from”ViewContainer.onRender
onrightclick?
Section titled “onrightclick?”
optionalonrightclick?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:758
Property-based event handler for the rightclick event.
Fired when a right-click (context menu) action is performed on the object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('rightclick', (event) => { console.log('Right-clicked at:', event.global.x, event.global.y);});// Using property-based handlersprite.onrightclick = (event) => { console.log('Right-clicked at:', event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onrightclick
onrightdown?
Section titled “onrightdown?”
optionalonrightdown?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:778
Property-based event handler for the rightdown event.
Fired when a right mouse button is pressed down over the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('rightdown', (event) => { sprite.scale.set(0.9);});// Using property-based handlersprite.onrightdown = (event) => { sprite.scale.set(0.9);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onrightdown
onrightup?
Section titled “onrightup?”
optionalonrightup?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:798
Property-based event handler for the rightup event.
Fired when a right mouse button is released over the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('rightup', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onrightup = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onrightup
onrightupoutside?
Section titled “onrightupoutside?”
optionalonrightupoutside?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:819
Property-based event handler for the rightupoutside event.
Fired when a right mouse button is released outside the bounds of the display object
that initially registered a rightdown.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('rightupoutside', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.onrightupoutside = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onrightupoutside
ontap?
Section titled “ontap?”
optionalontap?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:839
Property-based event handler for the tap event.
Fired when a tap action (touch) is completed on the object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('tap', (event) => { console.log('Sprite tapped at:', event.global.x, event.global.y);});// Using property-based handlersprite.ontap = (event) => { console.log('Sprite tapped at:', event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.ontap
ontouchcancel?
Section titled “ontouchcancel?”
optionalontouchcancel?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:859
Property-based event handler for the touchcancel event.
Fired when a touch interaction is canceled, such as when the touch is interrupted.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('touchcancel', (event) => { console.log('Touch canceled at:', event.global.x, event.global.y);});// Using property-based handlersprite.ontouchcancel = (event) => { console.log('Touch canceled at:', event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.ontouchcancel
ontouchend?
Section titled “ontouchend?”
optionalontouchend?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:879
Property-based event handler for the touchend event.
Fired when a touch interaction ends, such as when the finger is lifted from the screen.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('touchend', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.ontouchend = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.ontouchend
ontouchendoutside?
Section titled “ontouchendoutside?”
optionalontouchendoutside?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:900
Property-based event handler for the touchendoutside event.
Fired when a touch interaction ends outside the bounds of the display object
that initially registered a touchstart.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('touchendoutside', (event) => { sprite.scale.set(1.0);});// Using property-based handlersprite.ontouchendoutside = (event) => { sprite.scale.set(1.0);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.ontouchendoutside
ontouchmove?
Section titled “ontouchmove?”
optionalontouchmove?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:920
Property-based event handler for the touchmove event.
Fired when a touch interaction moves while over the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('touchmove', (event) => { sprite.position.set(event.global.x, event.global.y);});// Using property-based handlersprite.ontouchmove = (event) => { sprite.position.set(event.global.x, event.global.y);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.ontouchmove
ontouchstart?
Section titled “ontouchstart?”
optionalontouchstart?:FederatedEventHandler<FederatedPointerEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:967
Property-based event handler for the touchstart event.
Fired when a touch interaction starts, such as when a finger touches the screen.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('touchstart', (event) => { sprite.scale.set(0.9);});// Using property-based handlersprite.ontouchstart = (event) => { sprite.scale.set(0.9);};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.ontouchstart
onwheel?
Section titled “onwheel?”
optionalonwheel?:FederatedEventHandler<FederatedWheelEvent> |null
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:989
Property-based event handler for the wheel event.
Fired when the mouse wheel is scrolled while over the display object.
Example
Section titled “Example”const sprite = new Sprite(texture);sprite.eventMode = 'static';
// Using emitter handlersprite.on('wheel', (event) => { sprite.scale.x += event.deltaY * 0.01; // Zoom in/out sprite.scale.y += event.deltaY * 0.01; // Zoom in/out});// Using property-based handlersprite.onwheel = (event) => { sprite.scale.x += event.deltaY * 0.01; // Zoom in/out sprite.scale.y += event.deltaY * 0.01; // Zoom in/out};Default
Section titled “Default”nullInherited from
Section titled “Inherited from”ViewContainer.onwheel
parent
Section titled “parent”
readonlyparent:Container<ContainerChild> |null
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:659
The display object container that contains this display object. This represents the parent-child relationship in the display tree.
Example
Section titled “Example”// Basic parent accessconst parent = sprite.parent;
// Walk up the treelet current = sprite;while (current.parent) { console.log('Level up:', current.parent.constructor.name); current = current.parent;}- Container#addChild For adding to a parent
- Container#removeChild For removing from parent
Inherited from
Section titled “Inherited from”ViewContainer.parent
parentRenderLayer
Section titled “parentRenderLayer”
readonlyparentRenderLayer:RenderLayer|null
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:672
The RenderLayer this container belongs to, if any. If it belongs to a RenderLayer, it will be rendered from the RenderLayer’s position in the scene.
Advanced
Section titled “Advanced”Inherited from
Section titled “Inherited from”ViewContainer.parentRenderLayer
relativeGroupTransform
Section titled “relativeGroupTransform”
readonlyrelativeGroupTransform:Matrix
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:696
The relative group transform is a transform relative to the render group it belongs too. It will include all parent transforms and up to the render group (think of it as kind of like a stage - but the stage can be nested). If this container is is self a render group matrix will be relative to its parent render group
Advanced
Section titled “Advanced”Inherited from
Section titled “Inherited from”ViewContainer.relativeGroupTransform
renderPipeId
Section titled “renderPipeId”
readonlyrenderPipeId:string
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:221
Internal
Inherited from
Section titled “Inherited from”ViewContainer.renderPipeId
sortableChildren
Section titled “sortableChildren”sortableChildren:
boolean
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts:48
If set to true, the container will sort its children by zIndex value
when the next render is called, or manually if sortChildren() is called.
This actually changes the order of elements in the array of children, so it will affect the rendering order.
[!NOTE] Also be aware of that this may not work nicely with the
addChildAt()function, as thezIndexsorting may cause the child to automatically sorted to another position.
Example
Section titled “Example”container.sortableChildren = true;Default
Section titled “Default”falseInherited from
Section titled “Inherited from”ViewContainer.sortableChildren
sortChildren
Section titled “sortChildren”sortChildren: () =>
void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts:72
Sorts children by zIndex value. Only sorts if container is marked as dirty.
Returns
Section titled “Returns”void
Example
Section titled “Example”// Basic sortingparticles.zIndex = 2; // Will mark as dirtycontainer.sortChildren();- Container#sortableChildren For enabling automatic sorting
- Container#zIndex For setting child order
Inherited from
Section titled “Inherited from”ViewContainer.sortChildren
sortDirty
Section titled “sortDirty”sortDirty:
boolean
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts:32
Internal
Should children be sorted by zIndex at the next render call.
Will get automatically set to true if a new child is added, or if a child’s zIndex changes.
Default
Section titled “Default”false@internalInherited from
Section titled “Inherited from”ViewContainer.sortDirty
tabIndex?
Section titled “tabIndex?”
optionaltabIndex?:number
Defined in: node_modules/pixi.js/lib/accessibility/accessibilityTarget.d.ts:72
Sets the tabIndex of the shadow div. You can use this to set the order of the elements when using the tab key to navigate.
Default
Section titled “Default”0Example
Section titled “Example”const container = new Container();container.accessible = true;container.tabIndex = 0;
const sprite = new Sprite(texture);sprite.accessible = true;sprite.tabIndex = 1;Inherited from
Section titled “Inherited from”ViewContainer.tabIndex
readonlyuid:number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:610
Internal
unique id for this container
Inherited from
Section titled “Inherited from”ViewContainer.uid
updateCacheTexture
Section titled “updateCacheTexture”updateCacheTexture: () =>
void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/cacheAsTextureMixin.d.ts:55
Updates the cached texture of this container. This will flag the container’s cached texture to be redrawn on the next render.
Returns
Section titled “Returns”void
Example
Section titled “Example”// Basic update after changescontainer.updateCacheTexture();Inherited from
Section titled “Inherited from”ViewContainer.updateCacheTexture
updateTick
Section titled “updateTick”updateTick:
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:674
Internal
Inherited from
Section titled “Inherited from”ViewContainer.updateTick
zIndex
Section titled “zIndex”zIndex:
number
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts:24
The zIndex of the container.
Controls the rendering order of children within their parent container.
A higher value will mean it will be moved towards the front of the rendering order.
Example
Section titled “Example”// Add in any ordercontainer.addChild(character, background, foreground);
// Adjust rendering orderbackground.zIndex = 0;character.zIndex = 1;foreground.zIndex = 2;- Container#sortableChildren For enabling sorting
- Container#sortChildren For manual sorting
Default
Section titled “Default”0Inherited from
Section titled “Inherited from”ViewContainer.zIndex
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get alpha():
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1246
The opacity of the object relative to its parent’s opacity. Value ranges from 0 (fully transparent) to 1 (fully opaque).
Example
Section titled “Example”// Basic transparencysprite.alpha = 0.5; // 50% opacity
// Inherited opacitycontainer.alpha = 0.5;const child = new Sprite(texture);child.alpha = 0.5;container.addChild(child);// child's effective opacity is 0.25 (0.5 * 0.5)Default
Section titled “Default”1- Container#visible For toggling visibility
- Container#renderable For render control
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set alpha(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1226
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.alpha
anchor
Section titled “anchor”Get Signature
Section titled “Get Signature”get anchor():
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:268
The anchor sets the origin point of the sprite. The default value is taken from the Texture and passed to the constructor.
- The default is
(0,0), this means the sprite’s origin is the top left. - Setting the anchor to
(0.5,0.5)means the sprite’s origin is centered. - Setting the anchor to
(1,1)would mean the sprite’s origin point will be the bottom right corner.
If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
Example
Section titled “Example”// Center the anchor pointsprite.anchor = 0.5; // Sets both x and y to 0.5sprite.position.set(400, 300); // Sprite will be centered at this position
// Set specific x/y anchor pointssprite.anchor = { x: 1, // Right edge y: 0 // Top edge};
// Using individual coordinatessprite.anchor.set(0.5, 1); // Center-bottom
// For rotation around centersprite.anchor.set(0.5);sprite.rotation = Math.PI / 4; // 45 degrees around center
// For scaling from centersprite.anchor.set(0.5);sprite.scale.set(2); // Scales from center pointReturns
Section titled “Returns”ObservablePoint
Set Signature
Section titled “Set Signature”set anchor(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:269
Parameters
Section titled “Parameters”number | PointData
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get angle():
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1008
The angle of the object in degrees.
[!NOTE] ‘rotation’ and ‘angle’ have the same effect on a display object; rotation is in radians, angle is in degrees.
Example
Section titled “Example”// Basic angle rotationsprite.angle = 45; // 45 degrees
// Rotate around centersprite.pivot.set(sprite.width / 2, sprite.height / 2);sprite.angle = 180; // Half rotation
// Rotate around center with originsprite.origin.set(sprite.width / 2, sprite.height / 2);sprite.angle = 180; // Half rotation
// Reset rotationsprite.angle = 0;Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set angle(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1009
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.angle
blendMode
Section titled “blendMode”Get Signature
Section titled “Get Signature”get blendMode():
BLEND_MODES
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1289
The blend mode to be applied to the sprite. Controls how pixels are blended when rendering.
Setting to ‘normal’ will reset to default blending.
[!NOTE] More blend modes are available after importing the
pixi.js/advanced-blend-modessub-export.
Example
Section titled “Example”// Basic blend modessprite.blendMode = 'add'; // Additive blendingsprite.blendMode = 'multiply'; // Multiply colorssprite.blendMode = 'screen'; // Screen blend
// Reset blend modesprite.blendMode = 'normal'; // Normal blendingDefault
Section titled “Default”'normal'- Container#alpha For transparency
- Container#tint For color adjustments
Returns
Section titled “Returns”BLEND_MODES
Set Signature
Section titled “Set Signature”set blendMode(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1269
Parameters
Section titled “Parameters”BLEND_MODES
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.blendMode
bottomHeight
Section titled “bottomHeight”Get Signature
Section titled “Get Signature”get bottomHeight():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:407
Height of the bottom horizontal bar (D). Controls the size of the bottom edge that remains unscaled
Example
Section titled “Example”const sprite = new NineSliceSprite({ ..., bottomHeight: 20 });sprite.bottomHeight = 20; // Set bottom border heightDefault
Section titled “Default”10Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set bottomHeight(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:408
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
bounds
Section titled “bounds”Get Signature
Section titled “Get Signature”get bounds():
Bounds
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:74
The local bounds of the view in its own coordinate space. Bounds are automatically updated when the view’s content changes.
Example
Section titled “Example”// Get bounds dimensionsconst bounds = view.bounds;console.log(`Width: ${bounds.maxX - bounds.minX}`);console.log(`Height: ${bounds.maxY - bounds.minY}`);Bounds For bounds operations
Returns
Section titled “Returns”Bounds
The rectangular bounds of the view
Inherited from
Section titled “Inherited from”ViewContainer.bounds
filters
Section titled “filters”Get Signature
Section titled “Get Signature”get filters(): readonly
Filter[]
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:254
Sets the filters for the displayObject. Filters are visual effects that can be applied to any display object and its children.
[!IMPORTANT] This is a WebGL/WebGPU only feature and will be ignored by the canvas renderer.
Example
Section titled “Example”new Container({ filters: [new BlurFilter(2), new ColorMatrixFilter()],});Filter For filter base class
Returns
Section titled “Returns”readonly Filter[]
Set Signature
Section titled “Set Signature”set filters(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:253
Sets the filters for the displayObject. Filters are visual effects that can be applied to any display object and its children.
[!IMPORTANT] This is a WebGL/WebGPU only feature and will be ignored by the canvas renderer.
Example
Section titled “Example”// Add a single filtersprite.filters = new BlurFilter(2);
// Apply multiple filterscontainer.filters = [ new BlurFilter(2), new ColorMatrixFilter(),];
// Remove filterssprite.filters = null;Filter For filter base class
Parameters
Section titled “Parameters”Filter | Filter[] | null | undefined
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.filters
height
Section titled “height”Get Signature
Section titled “Get Signature”get height():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:314
The height of the NineSliceSprite, setting this will actually modify the vertices and UV’s of this plane. The height affects how the middle sections are scaled.
Example
Section titled “Example”// Create a nine-slice sprite with fixed heightconst panel = new NineSliceSprite({ texture: Texture.from('panel.png'), height: 150 // Sets initial height});
// Adjust height dynamicallypanel.height = 200; // Stretches middle sections
// Create responsive UI elementconst dialog = new NineSliceSprite({ texture: Texture.from('dialog.png'), topHeight: 30, bottomHeight: 30, height: parent.height * 0.5 // 50% of parent height});- NineSliceSprite#setSize For setting both width and height efficiently
- NineSliceSprite#width For setting width
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set height(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:315
The height of the Container,
[!NOTE] Changing the height will adjust the scale.y property of the container while maintaining its aspect ratio. [!NOTE] If you want to set both width and height at the same time, use Container#setSize as it is more optimized by not recalculating the local bounds twice.
Example
Section titled “Example”// Basic height settingcontainer.height = 200;// Optimized height settingcontainer.setSize(100, 200);Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.height
isRenderable
Section titled “isRenderable”Get Signature
Section titled “Get Signature”get isRenderable():
boolean
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1329
Whether or not the object should be rendered.
Advanced
Section titled “Advanced”Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ViewContainer.isRenderable
isRenderGroup
Section titled “isRenderGroup”Get Signature
Section titled “Get Signature”get isRenderGroup():
boolean
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:894
Returns true if this container is a render group. This means that it will be rendered as a separate pass, with its own set of instructions
Advanced
Section titled “Advanced”Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set isRenderGroup(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:888
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.isRenderGroup
leftWidth
Section titled “leftWidth”Get Signature
Section titled “Get Signature”get leftWidth():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:371
Width of the left vertical bar (A). Controls the size of the left edge that remains unscaled
Example
Section titled “Example”const sprite = new NineSliceSprite({ ..., leftWidth: 20 });sprite.leftWidth = 20; // Set left border widthDefault
Section titled “Default”10Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set leftWidth(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:372
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
origin
Section titled “origin”Get Signature
Section titled “Get Signature”get origin():
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1087
The origin point around which the container rotates and scales without affecting its position. Unlike pivot, changing the origin will not move the container’s position.
Example
Section titled “Example”// Rotate around center pointcontainer.origin.set(container.width / 2, container.height / 2);container.rotation = Math.PI; // Rotates around center
// Reset origincontainer.origin.set(0, 0);Returns
Section titled “Returns”ObservablePoint
Set Signature
Section titled “Set Signature”set origin(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1088
Parameters
Section titled “Parameters”number | PointData
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.origin
originalHeight
Section titled “originalHeight”Get Signature
Section titled “Get Signature”get originalHeight():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:462
The original height of the texture before any nine-slice scaling. This is the height of the source texture used to create the nine-slice sprite.
Example
Section titled “Example”// Get original dimensionsconsole.log(`Original size: ${sprite.originalWidth}x${sprite.originalHeight}`);
// Use for relative scalingsprite.height = sprite.originalHeight * 2; // Double the original height
// Reset to original sizesprite.setSize(sprite.originalWidth, sprite.originalHeight);- NineSliceSprite#height For the current displayed height
- Texture#height For direct texture height access
Returns
Section titled “Returns”number
The original height of the texture
originalWidth
Section titled “originalWidth”Get Signature
Section titled “Get Signature”get originalWidth():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:442
The original width of the texture before any nine-slice scaling. This is the width of the source texture used to create the nine-slice sprite.
Example
Section titled “Example”// Get original dimensionsconsole.log(`Original size: ${sprite.originalWidth}x${sprite.originalHeight}`);
// Use for relative scalingsprite.width = sprite.originalWidth * 2; // Double the original width
// Reset to original sizesprite.setSize(sprite.originalWidth, sprite.originalHeight);- NineSliceSprite#width For the current displayed width
- Texture#width For direct texture width access
Returns
Section titled “Returns”number
The original width of the texture
Get Signature
Section titled “Get Signature”get pivot():
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1023
The center of rotation, scaling, and skewing for this display object in its local space.
The position is the projection of pivot in the parent’s local space.
By default, the pivot is the origin (0, 0).
Example
Section titled “Example”// Rotate around centercontainer.pivot.set(container.width / 2, container.height / 2);container.rotation = Math.PI; // Rotates around center4.0.0
Returns
Section titled “Returns”ObservablePoint
Set Signature
Section titled “Set Signature”set pivot(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1024
Parameters
Section titled “Parameters”number | PointData
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.pivot
position
Section titled “position”Get Signature
Section titled “Get Signature”get position():
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:959
The coordinate of the object relative to the local coordinates of the parent.
Example
Section titled “Example”// Basic position settingcontainer.position.set(100, 200);container.position.set(100); // Sets both x and y to 100// Using point datacontainer.position = { x: 50, y: 75 };4.0.0
Returns
Section titled “Returns”ObservablePoint
Set Signature
Section titled “Set Signature”set position(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:960
Parameters
Section titled “Parameters”PointData
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.position
renderable
Section titled “renderable”Get Signature
Section titled “Get Signature”get renderable():
boolean
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1323
Controls whether this object can be rendered. If false the object will not be drawn, but the transform will still be updated. This is different from visible, which skips transform updates.
Example
Section titled “Example”// Basic render controlsprite.renderable = false; // Skip renderingsprite.renderable = true; // Enable renderingDefault
Section titled “Default”true- Container#visible For skipping transform updates
- Container#alpha For transparency
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set renderable(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1324
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.renderable
rightWidth
Section titled “rightWidth”Get Signature
Section titled “Get Signature”get rightWidth():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:395
Width of the right vertical bar (B). Controls the size of the right edge that remains unscaled
Example
Section titled “Example”const sprite = new NineSliceSprite({ ..., rightWidth: 20 });sprite.rightWidth = 20; // Set right border widthDefault
Section titled “Default”10Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set rightWidth(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:396
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
rotation
Section titled “rotation”Get Signature
Section titled “Get Signature”get rotation():
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:984
The rotation of the object in radians.
[!NOTE] ‘rotation’ and ‘angle’ have the same effect on a display object; rotation is in radians, angle is in degrees.
Example
Section titled “Example”// Basic rotationcontainer.rotation = Math.PI / 4; // 45 degrees
// Convert from degreesconst degrees = 45;container.rotation = degrees * Math.PI / 180;
// Rotate around centercontainer.pivot.set(container.width / 2, container.height / 2);container.rotation = Math.PI; // 180 degrees
// Rotate around center with origincontainer.origin.set(container.width / 2, container.height / 2);container.rotation = Math.PI; // 180 degreesReturns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set rotation(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:985
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.rotation
roundPixels
Section titled “roundPixels”Get Signature
Section titled “Get Signature”get roundPixels():
boolean
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:86
Whether or not to round the x/y position of the sprite.
Example
Section titled “Example”// Enable pixel rounding for crisp renderingview.roundPixels = true;Default
Section titled “Default”falseReturns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set roundPixels(
value):void
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:87
Whether or not to round the x/y position of the object.
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.roundPixels
Get Signature
Section titled “Get Signature”get scale():
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1071
The scale factors of this object along the local coordinate axes.
The default scale is (1, 1).
Example
Section titled “Example”// Basic scalingcontainer.scale.set(2, 2); // Scales to double sizecontainer.scale.set(2); // Scales uniformly to double sizecontainer.scale = 2; // Scales uniformly to double size// Scale to a specific width and heightcontainer.setSize(200, 100); // Sets width to 200 and height to 1004.0.0
Returns
Section titled “Returns”ObservablePoint
Set Signature
Section titled “Set Signature”set scale(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1072
Parameters
Section titled “Parameters”string | number | PointData
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.scale
Get Signature
Section titled “Get Signature”get skew():
ObservablePoint
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1054
The skew factor for the object in radians. Skewing is a transformation that distorts the object by rotating it differently at each point, creating a non-uniform shape.
Example
Section titled “Example”// Basic skewingcontainer.skew.set(0.5, 0); // Skew horizontallycontainer.skew.set(0, 0.5); // Skew vertically
// Skew with point datacontainer.skew = { x: 0.3, y: 0.3 }; // Diagonal skew
// Reset skewcontainer.skew.set(0, 0);
// Animate skewapp.ticker.add(() => { // Create wave effect container.skew.x = Math.sin(Date.now() / 1000) * 0.3;});
// Combine with rotationcontainer.rotation = Math.PI / 4; // 45 degreescontainer.skew.set(0.2, 0.2); // Skew the rotated object4.0.0
Default
Section titled “Default”{x: 0, y: 0}Returns
Section titled “Returns”ObservablePoint
Set Signature
Section titled “Set Signature”set skew(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1055
Parameters
Section titled “Parameters”PointData
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.skew
texture
Section titled “texture”Get Signature
Section titled “Get Signature”get texture():
Texture
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:421
The texture to use on the NineSliceSprite.
// Create a sprite with a textureconst sprite = new NineSliceSprite({ texture: Texture.from('path/to/image.png')});// Update the texture latersprite.texture = Texture.from('path/to/another-image.png');Default
Section titled “Default”Texture.EMPTYReturns
Section titled “Returns”Texture
Set Signature
Section titled “Set Signature”set texture(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:422
Parameters
Section titled “Parameters”Texture
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get tint():
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1268
The tint applied to the sprite.
This can be any valid ColorSource.
Example
Section titled “Example”// Basic color tintingcontainer.tint = 0xff0000; // Red tintcontainer.tint = 'red'; // Same as abovecontainer.tint = '#00ff00'; // Greencontainer.tint = 'rgb(0,0,255)'; // Blue
// Remove tintcontainer.tint = 0xffffff; // White = no tintcontainer.tint = null; // Also removes tintDefault
Section titled “Default”0xFFFFFF- Container#alpha For transparency
- Container#visible For visibility control
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set tint(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1247
Parameters
Section titled “Parameters”ColorSource
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.tint
topHeight
Section titled “topHeight”Get Signature
Section titled “Get Signature”get topHeight():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:383
Height of the top horizontal bar (C). Controls the size of the top edge that remains unscaled
Example
Section titled “Example”const sprite = new NineSliceSprite({ ..., topHeight: 20 });sprite.topHeight = 20; // Set top border heightDefault
Section titled “Default”10Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set topHeight(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:384
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get trim():
Rectangle
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:471
Internal
The trim rectangle of the underlying texture, or null if the texture is not trimmed.
This is forwarded to the NineSliceGeometry so that UV coordinates are clamped
to the visible pixel region, preventing transparent atlas padding from bleeding into
the rendered sprite corners.
Returns
Section titled “Returns”Rectangle
visible
Section titled “visible”Get Signature
Section titled “Get Signature”get visible():
boolean
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1303
The visibility of the object. If false the object will not be drawn, and the transform will not be updated.
Example
Section titled “Example”// Basic visibility togglesprite.visible = false; // Hide spritesprite.visible = true; // Show spriteDefault
Section titled “Default”true- Container#renderable For render-only control
- Container#alpha For transparency
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set visible(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1304
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.visible
Get Signature
Section titled “Get Signature”get width():
number
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:287
The width of the NineSliceSprite, setting this will actually modify the vertices and UV’s of this plane. The width affects how the middle sections are scaled.
Example
Section titled “Example”// Create a nine-slice sprite with fixed widthconst panel = new NineSliceSprite({ texture: Texture.from('panel.png'), width: 200 // Sets initial width});
// Adjust width dynamicallypanel.width = 300; // Stretches middle sections- NineSliceSprite#setSize For setting both width and height efficiently
- NineSliceSprite#height For setting height
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set width(
value):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:288
The width of the Container, setting this will actually modify the scale to achieve the value set.
[!NOTE] Changing the width will adjust the scale.x property of the container while maintaining its aspect ratio. [!NOTE] If you want to set both width and height at the same time, use Container#setSize as it is more optimized by not recalculating the local bounds twice.
Example
Section titled “Example”// Basic width settingcontainer.width = 100;// Optimized width settingcontainer.setSize(100, 100);Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.width
worldTransform
Section titled “worldTransform”Get Signature
Section titled “Get Signature”get worldTransform():
Matrix
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:922
Current transform of the object based on world (parent) factors.
This matrix represents the absolute transformation in the scene graph.
Example
Section titled “Example”// Get world positionconst worldPos = container.worldTransform;console.log(`World position: (${worldPos.tx}, ${worldPos.ty})`);Container#localTransform For local space transform
Returns
Section titled “Returns”Matrix
Inherited from
Section titled “Inherited from”ViewContainer.worldTransform
Get Signature
Section titled “Get Signature”get x():
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:933
The position of the container on the x axis relative to the local coordinates of the parent.
An alias to position.x
Example
Section titled “Example”// Basic positioncontainer.x = 100;Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set x(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:934
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.x
Get Signature
Section titled “Get Signature”get y():
number
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:945
The position of the container on the y axis relative to the local coordinates of the parent.
An alias to position.y
Example
Section titled “Example”// Basic positioncontainer.y = 200;Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set y(
value):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:946
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.y
Methods
Section titled “Methods”_getGlobalBoundsRecursive()
Section titled “_getGlobalBoundsRecursive()”_getGlobalBoundsRecursive(
factorRenderLayers,bounds,currentLayer):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/getFastGlobalBoundsMixin.d.ts:32
Internal
Recursively calculates the global bounds for the container and its children. This method is used internally by getFastGlobalBounds to traverse the scene graph.
Parameters
Section titled “Parameters”factorRenderLayers
Section titled “factorRenderLayers”boolean
A flag indicating whether to consider render layers in the calculation.
bounds
Section titled “bounds”Bounds
The bounds object to update with the calculated values.
currentLayer
Section titled “currentLayer”RenderLayer
The current render layer being processed.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer._getGlobalBoundsRecursive
_onTouch()?
Section titled “_onTouch()?”
optional_onTouch(now):void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/GCSystem.d.ts:31
An optional callback for when an item is touched
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer._onTouch
addChild()
Section titled “addChild()”addChild<
U>(…children):U[0]
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:864
Adds one or more children to the container. The children will be rendered as part of this container’s display list.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild[]
Parameters
Section titled “Parameters”children
Section titled “children”…U
The Container(s) to add to the container
Returns
Section titled “Returns”U[0]
The first child that was added
Example
Section titled “Example”// Add a single childcontainer.addChild(sprite);
// Add multiple childrencontainer.addChild(background, player, foreground);
// Add with type checkingconst sprite = container.addChild<Sprite>(new Sprite(texture));sprite.tint = 'red';- Container#removeChild For removing children
- Container#addChildAt For adding at specific index
Inherited from
Section titled “Inherited from”ViewContainer.addChild
addChildAt()
Section titled “addChildAt()”addChildAt<
U>(child,index):U
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:161
Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown. If the child is already in this container, it will be moved to the specified index.
When moving a child within the same container, childAdded and added events are
not emitted because the parent-child relationship hasn’t changed. Events only fire when
a child is added from a different parent (or from no parent).
Type Parameters
Section titled “Type Parameters”U extends ContainerChild
Parameters
Section titled “Parameters”U
The child to add
number
The index where the child will be placed
Returns
Section titled “Returns”U
The child that was added
Example
Section titled “Example”// Add at specific indexcontainer.addChildAt(sprite, 0); // Add to front
// Move existing child (no events emitted)const index = container.children.length - 1;container.addChildAt(existingChild, index); // Move to back
// With error handlingtry { container.addChildAt(sprite, 1000);} catch (e) { console.warn('Index out of bounds');}Throws
Section titled “Throws”If index is out of bounds
- Container#addChild For adding to the end
- Container#setChildIndex For moving existing children
Inherited from
Section titled “Inherited from”ViewContainer.addChildAt
addEventListener()
Section titled “addEventListener()”Call Signature
Section titled “Call Signature”addEventListener<
K>(type,listener,options?):void
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:1072
Unlike on or addListener which are methods from EventEmitter, addEventListener
seeks to be compatible with the DOM’s addEventListener with support for options.
Type Parameters
Section titled “Type Parameters”K extends keyof FederatedEventMap | keyof GlobalFederatedEventMap
Parameters
Section titled “Parameters”K
The type of event to listen to.
listener
Section titled “listener”(e) => any
The listener callback or object.
options?
Section titled “options?”AddListenerOptions
Listener options, used for capture phase.
Returns
Section titled “Returns”void
Example
Section titled “Example”// Tell the user whether they did a single, double, triple, or nth click.button.addEventListener('click', { handleEvent(e): { let prefix;
switch (e.detail) { case 1: prefix = 'single'; break; case 2: prefix = 'double'; break; case 3: prefix = 'triple'; break; default: prefix = e.detail + 'th'; break; }
console.log('That was a ' + prefix + 'click'); }});
// But skip the first click!button.parent.addEventListener('click', function blockClickOnce(e) { e.stopImmediatePropagation(); button.parent.removeEventListener('click', blockClickOnce, true);}, { capture: true,});Inherited from
Section titled “Inherited from”ViewContainer.addEventListener
Call Signature
Section titled “Call Signature”addEventListener(
type,listener,options?):void
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:1073
Parameters
Section titled “Parameters”string
listener
Section titled “listener”EventListenerOrEventListenerObject
options?
Section titled “options?”AddListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.addEventListener
addListener()
Section titled “addListener()”addListener<
T>(event,fn,context?):this
Defined in: node_modules/eventemitter3/index.d.ts:45
Type Parameters
Section titled “Type Parameters”T extends keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ViewContainer.addListener
collectRenderables()
Section titled “collectRenderables()”collectRenderables(
instructionSet,renderer,currentLayer):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/collectRenderablesMixin.d.ts:21
Internal
Collects all renderables from the container and its children, adding them to the instruction set. This method decides whether to use a simple or advanced collection method based on the container’s properties.
Parameters
Section titled “Parameters”instructionSet
Section titled “instructionSet”InstructionSet
The set of instructions to which the renderables will be added.
renderer
Section titled “renderer”Renderer
The renderer responsible for rendering the scene.
currentLayer
Section titled “currentLayer”RenderLayer
The current render layer being processed.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.collectRenderables
collectRenderablesSimple()
Section titled “collectRenderablesSimple()”collectRenderablesSimple(
instructionSet,renderer,currentLayer):void
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:119
Internal
Collects renderables for the view container.
Parameters
Section titled “Parameters”instructionSet
Section titled “instructionSet”InstructionSet
The instruction set to collect renderables for.
renderer
Section titled “renderer”Renderer
The renderer to collect renderables for.
currentLayer
Section titled “currentLayer”RenderLayer
The current render layer.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.collectRenderablesSimple
collectRenderablesWithEffects()
Section titled “collectRenderablesWithEffects()”collectRenderablesWithEffects(
instructionSet,renderer,currentLayer):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/collectRenderablesMixin.d.ts:39
Internal
Collects renderables using an advanced method, suitable for containers with complex processing needs. This method handles additional effects and transformations that may be applied to the renderables.
Parameters
Section titled “Parameters”instructionSet
Section titled “instructionSet”InstructionSet
The set of instructions to which the renderables will be added.
renderer
Section titled “renderer”Renderer
The renderer responsible for rendering the scene.
currentLayer
Section titled “currentLayer”RenderLayer
The current render layer being processed.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.collectRenderablesWithEffects
containsPoint()
Section titled “containsPoint()”containsPoint(
point):boolean
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:104
Checks if the object contains the given point in local coordinates. Uses the view’s bounds for hit testing.
Parameters
Section titled “Parameters”PointData
The point to check in local coordinates
Returns
Section titled “Returns”boolean
True if the point is within the view’s bounds
Example
Section titled “Example”// Basic point checkconst localPoint = { x: 50, y: 25 };const contains = view.containsPoint(localPoint);console.log('Point is inside:', contains);- ViewContainer#bounds For the bounds used in hit testing
- Container#toLocal For converting global coordinates to local
Inherited from
Section titled “Inherited from”ViewContainer.containsPoint
destroy()
Section titled “destroy()”destroy(
options?):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:481
Destroys this sprite renderable and optionally its texture.
Parameters
Section titled “Parameters”options?
Section titled “options?”DestroyOptions
Options parameter. A boolean will act as if all options have been set to that value
Returns
Section titled “Returns”void
Example
Section titled “Example”nineSliceSprite.destroy();nineSliceSprite.destroy(true);nineSliceSprite.destroy({ texture: true, textureSource: true });Inherited from
Section titled “Inherited from”ViewContainer.destroy
disableRenderGroup()
Section titled “disableRenderGroup()”disableRenderGroup():
void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:906
This will disable the render group for this container.
Returns
Section titled “Returns”void
Advanced
Section titled “Advanced”Inherited from
Section titled “Inherited from”ViewContainer.disableRenderGroup
dispatchEvent()
Section titled “dispatchEvent()”dispatchEvent(
e):boolean
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:1094
Dispatch the event on this Container using the event’s EventBoundary.
The target of the event is set to this and the defaultPrevented flag is cleared before dispatch.
Parameters
Section titled “Parameters”FederatedEvent
The event to dispatch.
Returns
Section titled “Returns”boolean
Whether the FederatedEvent.preventDefault preventDefault() method was not invoked.
Example
Section titled “Example”// Reuse a click event!button.dispatchEvent(clickEvent);Inherited from
Section titled “Inherited from”ViewContainer.dispatchEvent
emit()
Section titled “emit()”emit<
T>(event, …args):boolean
Defined in: node_modules/eventemitter3/index.d.ts:32
Calls each of the listeners registered for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Parameters
Section titled “Parameters”T
…ArgumentMap<ContainerEvents<ContainerChild> & AnyEvent>[Extract<T, keyof AnyEvent | keyof ContainerEvents<ContainerChild>>]
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ViewContainer.emit
enableRenderGroup()
Section titled “enableRenderGroup()”enableRenderGroup():
void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:901
Calling this enables a render group for this container. This means it will be rendered as a separate set of instructions. The transform of the container will also be handled on the GPU rather than the CPU.
Returns
Section titled “Returns”void
Advanced
Section titled “Advanced”Inherited from
Section titled “Inherited from”ViewContainer.enableRenderGroup
eventNames()
Section titled “eventNames()”eventNames(): (keyof AnyEvent | keyof ContainerEvents<ContainerChild>)[]
Defined in: node_modules/eventemitter3/index.d.ts:15
Return an array listing the events for which the emitter has registered listeners.
Returns
Section titled “Returns”(keyof AnyEvent | keyof ContainerEvents<ContainerChild>)[]
Inherited from
Section titled “Inherited from”ViewContainer.eventNames
getBounds()
Section titled “getBounds()”getBounds(
skipUpdate?,bounds?):Bounds
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.d.ts:88
Calculates and returns the (world) bounds of the display object as a Rectangle. Takes into account transforms and child bounds.
Parameters
Section titled “Parameters”skipUpdate?
Section titled “skipUpdate?”boolean
Setting to true will stop the transforms of the scene graph from
being updated. This means the calculation returned MAY be out of date BUT will give you a
nice performance boost.
bounds?
Section titled “bounds?”Bounds
Optional bounds to store the result of the bounds calculation
Returns
Section titled “Returns”Bounds
The minimum axis-aligned rectangle in world space that fits around this object
Example
Section titled “Example”// Basic bounds calculationconst bounds = sprite.getBounds();console.log(`World bounds: ${bounds.x}, ${bounds.y}, ${bounds.width}, ${bounds.height}`);
// Reuse bounds object for performanceconst recycleBounds = new Bounds();sprite.getBounds(false, recycleBounds);
// Skip update for performanceconst fastBounds = sprite.getBounds(true);Remarks
Section titled “Remarks”- Includes transform calculations
- Updates scene graph by default
- Can reuse bounds objects
- Common in hit testing
- Container#getLocalBounds For untransformed bounds
- Bounds For bounds properties
Inherited from
Section titled “Inherited from”ViewContainer.getBounds
getChildAt()
Section titled “getChildAt()”getChildAt<
U>(index):U
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:85
Returns the child at the specified index.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild
Parameters
Section titled “Parameters”number
The index to get the child from
Returns
Section titled “Returns”U
The child at the given index
Example
Section titled “Example”// Get first childconst first = container.getChildAt(0);
// Type-safe accessconst sprite = container.getChildAt<Sprite>(1);
// With error handlingtry { const child = container.getChildAt(10);} catch (e) { console.warn('Index out of bounds');}Throws
Section titled “Throws”If index is out of bounds
- Container#children For direct array access
- Container#getChildByLabel For name-based lookup
Inherited from
Section titled “Inherited from”ViewContainer.getChildAt
getChildByLabel()
Section titled “getChildByLabel()”getChildByLabel(
label,deep?):Container<ContainerChild> |null
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.d.ts:53
Returns the first child in the container with the specified label. Recursive searches are done in a pre-order traversal.
Parameters
Section titled “Parameters”string | RegExp
Instance label to search for
boolean
Whether to search recursively through children
Returns
Section titled “Returns”Container<ContainerChild> | null
The first child with the specified label, or null if none found
Example
Section titled “Example”// Basic label searchconst child = container.getChildByLabel('player');
// Search with regular expressionconst enemy = container.getChildByLabel(/enemy-\d+/);
// Deep search through childrenconst deepChild = container.getChildByLabel('powerup', true);- Container#getChildrenByLabel For finding all matches
- Container#label For setting labels
Inherited from
Section titled “Inherited from”ViewContainer.getChildByLabel
getChildByName()
Section titled “getChildByName()”getChildByName(
label,deep?):Container<ContainerChild> |null
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.d.ts:32
Parameters
Section titled “Parameters”string | RegExp
Instance name.
boolean
Whether to search recursively
Returns
Section titled “Returns”Container<ContainerChild> | null
The child with the specified name.
Container#getChildByLabel
Inherited from
Section titled “Inherited from”ViewContainer.getChildByName
getChildIndex()
Section titled “getChildIndex()”getChildIndex(
child):number
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:130
Returns the index position of a child Container instance.
Parameters
Section titled “Parameters”ContainerChild
The Container instance to identify
Returns
Section titled “Returns”number
The index position of the child container
Example
Section titled “Example”// Basic index lookupconst index = container.getChildIndex(sprite);console.log(`Sprite is at index ${index}`);
// With error handlingtry { const index = container.getChildIndex(sprite);} catch (e) { console.warn('Child not found in container');}Throws
Section titled “Throws”If child is not in this container
- Container#setChildIndex For changing index
- Container#children For direct array access
Inherited from
Section titled “Inherited from”ViewContainer.getChildIndex
getChildrenByLabel()
Section titled “getChildrenByLabel()”getChildrenByLabel(
label,deep?,out?):Container<ContainerChild>[]
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.d.ts:74
Returns all children in the container with the specified label. Recursive searches are done in a pre-order traversal.
Parameters
Section titled “Parameters”string | RegExp
Instance label to search for
boolean
Whether to search recursively through children
Container<ContainerChild>[]
Optional array to store matching children in
Returns
Section titled “Returns”Container<ContainerChild>[]
An array of children with the specified label
Example
Section titled “Example”// Basic label searchconst enemies = container.getChildrenByLabel('enemy');// Search with regular expressionconst powerups = container.getChildrenByLabel(/powerup-\d+/);// Deep search with collectionconst buttons = [];container.getChildrenByLabel('button', true, buttons);- Container#getChildByLabel For finding first match
- Container#label For setting labels
Inherited from
Section titled “Inherited from”ViewContainer.getChildrenByLabel
getFastGlobalBounds()
Section titled “getFastGlobalBounds()”getFastGlobalBounds(
factorRenderLayers?,bounds?):Bounds
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/getFastGlobalBoundsMixin.d.ts:23
Computes an approximate global bounding box for the container and its children. This method is optimized for speed by using axis-aligned bounding boxes (AABBs), and uses the last render results from when it updated the transforms. This function does not update them. which may result in slightly larger bounds but never smaller than the actual bounds.
for accurate (but less performant) results use container.getGlobalBounds
Parameters
Section titled “Parameters”factorRenderLayers?
Section titled “factorRenderLayers?”boolean
A flag indicating whether to consider render layers in the calculation.
bounds?
Section titled “bounds?”Bounds
The output bounds object to store the result. If not provided, a new one is created.
Returns
Section titled “Returns”Bounds
The computed bounds.
Advanced
Section titled “Advanced”Inherited from
Section titled “Inherited from”ViewContainer.getFastGlobalBounds
getGlobalAlpha()
Section titled “getGlobalAlpha()”getGlobalAlpha(
skipUpdate?):number
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/getGlobalMixin.d.ts:35
Returns the global (compound) alpha of the container within the scene.
Parameters
Section titled “Parameters”skipUpdate?
Section titled “skipUpdate?”boolean
Performance optimization flag:
- If false (default): Recalculates the entire alpha chain through parents for accuracy
- If true: Uses cached worldAlpha from the last render pass for better performance
Returns
Section titled “Returns”number
The resulting alpha value (between 0 and 1)
Example
Section titled “Example”// Accurate but slower - recalculates entire alpha chainconst preciseAlpha = container.getGlobalAlpha();
// Faster but may be outdated - uses cached alphaconst cachedAlpha = container.getGlobalAlpha(true);Inherited from
Section titled “Inherited from”ViewContainer.getGlobalAlpha
getGlobalPosition()
Section titled “getGlobalPosition()”getGlobalPosition(
point?,skipUpdate?):Point
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.d.ts:36
Returns the global position of the container, taking into account the container hierarchy.
Parameters
Section titled “Parameters”point?
Section titled “point?”Point
The optional point to write the global value to
skipUpdate?
Section titled “skipUpdate?”boolean
Should we skip the update transform
Returns
Section titled “Returns”Point
The updated point
Example
Section titled “Example”// Basic position checkconst globalPos = sprite.getGlobalPosition();console.log(`Global: (${globalPos.x}, ${globalPos.y})`);
// Reuse point objectconst point = new Point();sprite.getGlobalPosition(point);
// Skip transform update for performanceconst fastPos = container.getGlobalPosition(undefined, true);- Container#toGlobal For converting specific points
- Container#toLocal For converting to local space
Inherited from
Section titled “Inherited from”ViewContainer.getGlobalPosition
getGlobalTint()
Section titled “getGlobalTint()”getGlobalTint(
skipUpdate?):number
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/getGlobalMixin.d.ts:72
Returns the global (compound) tint color of the container within the scene.
Parameters
Section titled “Parameters”skipUpdate?
Section titled “skipUpdate?”boolean
Performance optimization flag:
- If false (default): Recalculates the entire tint chain through parents for accuracy
- If true: Uses cached worldColor from the last render pass for better performance
Returns
Section titled “Returns”number
The resulting tint color as a 24-bit RGB number (0xRRGGBB)
Example
Section titled “Example”// Accurate but slower - recalculates entire tint chainconst preciseTint = container.getGlobalTint();
// Faster but may be outdated - uses cached tintconst cachedTint = container.getGlobalTint(true);Inherited from
Section titled “Inherited from”ViewContainer.getGlobalTint
getGlobalTransform()
Section titled “getGlobalTransform()”getGlobalTransform(
matrix?,skipUpdate?):Matrix
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/getGlobalMixin.d.ts:56
Returns the global transform matrix of the container within the scene.
Parameters
Section titled “Parameters”matrix?
Section titled “matrix?”Matrix
Optional matrix to store the result. If not provided, a new Matrix will be created.
skipUpdate?
Section titled “skipUpdate?”boolean
Performance optimization flag:
- If false (default): Recalculates the entire transform chain for accuracy
- If true: Uses cached worldTransform from the last render pass for better performance
Returns
Section titled “Returns”Matrix
The resulting transformation matrix (either the input matrix or a new one)
Example
Section titled “Example”// Accurate but slower - recalculates entire transform chainconst preciseTransform = container.getGlobalTransform();
// Faster but may be outdated - uses cached transformconst cachedTransform = container.getGlobalTransform(undefined, true);
// Reuse existing matrixconst existingMatrix = new Matrix();container.getGlobalTransform(existingMatrix);Inherited from
Section titled “Inherited from”ViewContainer.getGlobalTransform
getLocalBounds()
Section titled “getLocalBounds()”getLocalBounds():
Bounds
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.d.ts:58
Retrieves the local bounds of the container as a Bounds object. Uses cached values when possible for better performance.
Returns
Section titled “Returns”Bounds
The bounding area
Example
Section titled “Example”// Basic bounds checkconst bounds = container.getLocalBounds();console.log(`Width: ${bounds.width}, Height: ${bounds.height}`);// subsequent calls will reuse the cached boundsconst cachedBounds = container.getLocalBounds();console.log(bounds === cachedBounds); // true- Container#getBounds For world space bounds
- Bounds For bounds properties
Inherited from
Section titled “Inherited from”ViewContainer.getLocalBounds
getSize()
Section titled “getSize()”getSize(
out?):Size
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:360
Retrieves the size of the NineSliceSprite as a [Size]Size object. This method is more efficient than getting width and height separately.
Parameters
Section titled “Parameters”Size
Optional object to store the size in, to avoid allocating a new object
Returns
Section titled “Returns”Size
The size of the NineSliceSprite
Example
Section titled “Example”// Get basic sizeconst size = panel.getSize();console.log(`Size: ${size.width}x${size.height}`);
// Reuse existing size objectconst reuseSize = { width: 0, height: 0 };panel.getSize(reuseSize);- NineSliceSprite#width For getting just the width
- NineSliceSprite#height For getting just the height
- NineSliceSprite#setSize For setting both width and height efficiently
Inherited from
Section titled “Inherited from”ViewContainer.getSize
listenerCount()
Section titled “listenerCount()”listenerCount(
event):number
Defined in: node_modules/eventemitter3/index.d.ts:27
Return the number of listeners listening to a given event.
Parameters
Section titled “Parameters”keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”ViewContainer.listenerCount
listeners()
Section titled “listeners()”listeners<
T>(event): (…args) =>void[]
Defined in: node_modules/eventemitter3/index.d.ts:20
Return the listeners registered for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”(…args) => void[]
Inherited from
Section titled “Inherited from”ViewContainer.listeners
off<
T>(event,fn?,context?,once?):this
Defined in: node_modules/eventemitter3/index.d.ts:69
Type Parameters
Section titled “Type Parameters”T extends keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ViewContainer.off
on<
T>(event,fn,context?):this
Defined in: node_modules/eventemitter3/index.d.ts:40
Add a listener for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ViewContainer.on
once()
Section titled “once()”once<
T>(event,fn,context?):this
Defined in: node_modules/eventemitter3/index.d.ts:54
Add a one-time listener for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ViewContainer.once
removeAllListeners()
Section titled “removeAllListeners()”removeAllListeners(
event?):this
Defined in: node_modules/eventemitter3/index.d.ts:79
Remove all listeners, or those of the specified event.
Parameters
Section titled “Parameters”event?
Section titled “event?”keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ViewContainer.removeAllListeners
removeChild()
Section titled “removeChild()”removeChild<
U>(…children):U[0]
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:885
Removes one or more children from the container. When removing multiple children, events will be triggered for each child in sequence.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild[]
Parameters
Section titled “Parameters”children
Section titled “children”…U
The Container(s) to remove
Returns
Section titled “Returns”U[0]
The first child that was removed
Example
Section titled “Example”// Remove a single childconst removed = container.removeChild(sprite);
// Remove multiple childrenconst bg = container.removeChild(background, player, userInterface);
// Remove with type checkingconst sprite = container.removeChild<Sprite>(childSprite);sprite.texture = newTexture;- Container#addChild For adding children
- Container#removeChildren For removing multiple children
Inherited from
Section titled “Inherited from”ViewContainer.removeChild
removeChildAt()
Section titled “removeChildAt()”removeChildAt<
U>(index):U
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:61
Removes a child from the specified index position.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild
Parameters
Section titled “Parameters”number
The index to remove the child from
Returns
Section titled “Returns”U
The child that was removed
Example
Section titled “Example”// Remove first childconst removed = container.removeChildAt(0);
// type safe accessconst sprite = container.removeChildAt<Sprite>(1);
// With error handlingtry { const child = container.removeChildAt(10);} catch (e) { console.warn('Index out of bounds');}Throws
Section titled “Throws”If index is out of bounds
- Container#removeChild For removing specific children
- Container#removeChildren For removing multiple children
Inherited from
Section titled “Inherited from”ViewContainer.removeChildAt
removeChildren()
Section titled “removeChildren()”removeChildren(
beginIndex?,endIndex?):ContainerChild[]
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:37
Removes all children from this container that are within the begin and end indexes.
Parameters
Section titled “Parameters”beginIndex?
Section titled “beginIndex?”number
The beginning position
endIndex?
Section titled “endIndex?”number
The ending position. Default is container size
Returns
Section titled “Returns”ContainerChild[]
List of removed children
Example
Section titled “Example”// Remove all childrencontainer.removeChildren();
// Remove first 3 childrenconst removed = container.removeChildren(0, 3);console.log('Removed:', removed.length); // 3
// Remove children from index 2 onwardscontainer.removeChildren(2);
// Remove specific rangeconst middle = container.removeChildren(1, 4);Throws
Section titled “Throws”If begin/end indexes are invalid
- Container#addChild For adding children
- Container#removeChild For removing specific children
Inherited from
Section titled “Inherited from”ViewContainer.removeChildren
removeEventListener()
Section titled “removeEventListener()”Call Signature
Section titled “Call Signature”removeEventListener<
K>(type,listener,options?):void
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:1082
Unlike off or removeListener which are methods from EventEmitter, removeEventListener
seeks to be compatible with the DOM’s removeEventListener with support for options.
Type Parameters
Section titled “Type Parameters”K extends keyof FederatedEventMap | keyof GlobalFederatedEventMap
Parameters
Section titled “Parameters”K
The type of event the listener is bound to.
listener
Section titled “listener”(e) => any
The listener callback or object.
options?
Section titled “options?”RemoveListenerOptions
The original listener options. This is required to deregister a capture phase listener.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.removeEventListener
Call Signature
Section titled “Call Signature”removeEventListener(
type,listener,options?):void
Defined in: node_modules/pixi.js/lib/events/FederatedEventTarget.d.ts:1083
Parameters
Section titled “Parameters”string
listener
Section titled “listener”EventListenerOrEventListenerObject
options?
Section titled “options?”RemoveListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.removeEventListener
removeFromParent()
Section titled “removeFromParent()”removeFromParent():
void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:203
Remove the Container from its parent Container. If the Container has no parent, do nothing.
Returns
Section titled “Returns”void
Example
Section titled “Example”// Basic removalsprite.removeFromParent();
// With validationif (sprite.parent) { sprite.removeFromParent();}- Container#addChild For adding to a new parent
- Container#removeChild For parent removing children
Inherited from
Section titled “Inherited from”ViewContainer.removeFromParent
removeListener()
Section titled “removeListener()”removeListener<
T>(event,fn?,context?,once?):this
Defined in: node_modules/eventemitter3/index.d.ts:63
Remove the listeners of a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof AnyEvent | keyof ContainerEvents<ContainerChild>
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ViewContainer.removeListener
reparentChild()
Section titled “reparentChild()”reparentChild<
U>(…child):U[0]
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:224
Reparent a child or multiple children to this container while preserving their world transform. This ensures that the visual position and rotation of the children remain the same even when changing parents.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild[]
Parameters
Section titled “Parameters”…U
The child or children to reparent
Returns
Section titled “Returns”U[0]
The first child that was reparented
Example
Section titled “Example”// Basic reparentingconst sprite = new Sprite(texture);oldContainer.addChild(sprite);// Move to new parent, keeping visual positionnewContainer.reparentChild(sprite);
// Reparent multiple childrenconst batch = [sprite1, sprite2, sprite3];newContainer.reparentChild(...batch);- Container#reparentChildAt For index-specific reparenting
- Container#addChild For simple parenting
Inherited from
Section titled “Inherited from”ViewContainer.reparentChild
reparentChildAt()
Section titled “reparentChildAt()”reparentChildAt<
U>(child,index):U
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:243
Reparent the child to this container at the specified index while preserving its world transform. This ensures that the visual position and rotation of the child remain the same even when changing parents.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild
Parameters
Section titled “Parameters”U
The child to reparent
number
The index to reparent the child to
Returns
Section titled “Returns”U
The reparented child
Example
Section titled “Example”// Basic index-specific reparentingconst sprite = new Sprite(texture);oldContainer.addChild(sprite);// Move to new parent at index 0 (front)newContainer.reparentChildAt(sprite, 0);Throws
Section titled “Throws”If index is out of bounds
- Container#reparentChild For appending reparented children
- Container#addChildAt For simple indexed parenting
Inherited from
Section titled “Inherited from”ViewContainer.reparentChildAt
replaceChild()
Section titled “replaceChild()”replaceChild<
U,T>(oldChild,newChild):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:249
Replace a child in the container with a new child. Copying the local transform from the old child to the new one.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild
T extends ContainerChild
Parameters
Section titled “Parameters”oldChild
Section titled “oldChild”U
The child to replace.
newChild
Section titled “newChild”T
The new child to add.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.replaceChild
setChildIndex()
Section titled “setChildIndex()”setChildIndex(
child,index):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:108
Changes the position of an existing child in the container.
Parameters
Section titled “Parameters”ContainerChild
The child Container instance to reposition
number
The resulting index number for the child
Returns
Section titled “Returns”void
Example
Section titled “Example”// Basic index changecontainer.setChildIndex(sprite, 0); // Move to frontcontainer.setChildIndex(sprite, container.children.length - 1); // Move to back
// With error handlingtry { container.setChildIndex(sprite, 5);} catch (e) { console.warn('Invalid index or child not found');}Throws
Section titled “Throws”If index is out of bounds
Throws
Section titled “Throws”If child is not in container
- Container#getChildIndex For getting current index
- Container#swapChildren For swapping positions
Inherited from
Section titled “Inherited from”ViewContainer.setChildIndex
setFromMatrix()
Section titled “setFromMatrix()”setFromMatrix(
matrix):void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1223
Updates the local transform properties by decomposing the given matrix. Extracts position, scale, rotation, and skew from a transformation matrix.
Parameters
Section titled “Parameters”matrix
Section titled “matrix”Matrix
The matrix to use for updating the transform
Returns
Section titled “Returns”void
Example
Section titled “Example”// Basic matrix transformconst matrix = new Matrix() .translate(100, 100) .rotate(Math.PI / 4) .scale(2, 2);
container.setFromMatrix(matrix);
// Copy transform from another containerconst source = new Container();source.position.set(100, 100);source.rotation = Math.PI / 2;
target.setFromMatrix(source.localTransform);
// Reset transformcontainer.setFromMatrix(Matrix.IDENTITY);- Container#updateTransform For property-based updates
- Matrix#decompose For matrix decomposition details
Inherited from
Section titled “Inherited from”ViewContainer.setFromMatrix
setMask()
Section titled “setMask()”setMask(
options):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:207
Used to set mask and control mask options on a display object. Allows for more detailed control over masking behavior compared to the mask property.
Parameters
Section titled “Parameters”options
Section titled “options”Partial<MaskOptionsAndMask>
Configuration options for the mask
Returns
Section titled “Returns”void
Example
Section titled “Example”import { Graphics, Sprite } from 'pixi.js';
// Create a circular maskconst graphics = new Graphics() .beginFill(0xFF3300) .drawCircle(100, 100, 50) .endFill();
// Apply mask with optionssprite.setMask({ mask: graphics, inverse: true, // Create a hole effect});
// Clear existing masksprite.setMask({ mask: null });- Container#mask For simple masking
- MaskOptionsAndMask For full options API
Inherited from
Section titled “Inherited from”ViewContainer.setMask
setSize()
Section titled “setSize()”setSize(
value,height?):void
Defined in: node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts:340
Sets the size of the NineSliceSprite to the specified width and height. This method directly modifies the vertices and UV coordinates of the sprite.
Using this is more efficient than setting width and height separately as it only triggers one update.
Parameters
Section titled “Parameters”number | Optional<Size, "height">
This can be either a number or a Size object with width/height properties
height?
Section titled “height?”number
The height to set. Defaults to the value of width if not provided
Returns
Section titled “Returns”void
Example
Section titled “Example”// Set to specific dimensionspanel.setSize(300, 200); // Width: 300, Height: 200
// Set uniform sizepanel.setSize(200); // Makes a square 200x200
// Set size using objectpanel.setSize({ width: 400, height: 300});- NineSliceSprite#width For setting width only
- NineSliceSprite#height For setting height only
Inherited from
Section titled “Inherited from”ViewContainer.setSize
swapChildren()
Section titled “swapChildren()”swapChildren<
U>(child,child2):void
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts:187
Swaps the position of 2 Containers within this container.
Type Parameters
Section titled “Type Parameters”U extends ContainerChild
Parameters
Section titled “Parameters”U
First container to swap
child2
Section titled “child2”U
Second container to swap
Returns
Section titled “Returns”void
Example
Section titled “Example”// Basic swapcontainer.swapChildren(sprite1, sprite2);
// With error handlingtry { container.swapChildren(sprite1, sprite2);} catch (e) { console.warn('One or both children not found in container');}Remarks
Section titled “Remarks”- Updates render groups
- No effect if same child
- Triggers container changes
- Common in z-ordering
Throws
Section titled “Throws”If either child is not in container
- Container#setChildIndex For direct index placement
- Container#getChildIndex For getting current positions
Inherited from
Section titled “Inherited from”ViewContainer.swapChildren
toGlobal()
Section titled “toGlobal()”toGlobal<
P>(position,point?,skipUpdate?):P
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.d.ts:64
Calculates the global position of a point relative to this container. Takes into account the container hierarchy and transforms.
Type Parameters
Section titled “Type Parameters”P extends PointData = Point
Parameters
Section titled “Parameters”position
Section titled “position”PointData
The local point to convert
point?
Section titled “point?”P
Optional point to store the result
skipUpdate?
Section titled “skipUpdate?”boolean
Whether to skip transform updates
Returns
Section titled “Returns”P
The global position
Example
Section titled “Example”// Basic point conversionconst localPoint = { x: 10, y: 20 };const globalPoint = container.toGlobal(localPoint);
// With point reuseconst reusePoint = new Point();container.toGlobal(localPoint, reusePoint);
// Performance optimizationconst fastPoint = container.toGlobal( { x: 50, y: 50 }, undefined, true // Skip transform update);- Container#toLocal For reverse conversion
- Container#getGlobalPosition For container position
Inherited from
Section titled “Inherited from”ViewContainer.toGlobal
toLocal()
Section titled “toLocal()”toLocal<
P>(position,from?,point?,skipUpdate?):P
Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.d.ts:100
Calculates the local position of the container relative to another point. Converts coordinates from any coordinate space to this container’s local coordinate space.
Type Parameters
Section titled “Type Parameters”P extends PointData = Point
Parameters
Section titled “Parameters”position
Section titled “position”PointData
The world origin to calculate from
Container<ContainerChild>
The Container to calculate the global position from
point?
Section titled “point?”P
A Point object in which to store the value
skipUpdate?
Section titled “skipUpdate?”boolean
Should we skip the update transform
Returns
Section titled “Returns”P
A point object representing the position in local space
Example
Section titled “Example”// Basic coordinate conversionconst worldPoint = { x: 100, y: 100 };const localPos = container.toLocal(worldPoint);
// Convert from another containerconst fromSprite = new Sprite(texture);fromSprite.position.set(50, 50);const pointInSprite = { x: 10, y: 10 };const localPoint = container.toLocal(pointInSprite, fromSprite);
// With point reuse for performanceconst reusePoint = new Point();container.toLocal(worldPoint, undefined, reusePoint);
// Skip transform update for static objectsconst fastLocal = container.toLocal( worldPoint, undefined, undefined, true);- Container#toGlobal For reverse conversion
- Container#getGlobalPosition For container position
Inherited from
Section titled “Inherited from”ViewContainer.toLocal
unload()
Section titled “unload()”unload():
void
Defined in: node_modules/pixi.js/lib/scene/view/ViewContainer.d.ts:110
Unloads the GPU data from the view.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.unload
updateLocalTransform()
Section titled “updateLocalTransform()”updateLocalTransform():
void
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1225
Updates the local transform.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ViewContainer.updateLocalTransform
updateTransform()
Section titled “updateTransform()”updateTransform(
opts):this
Defined in: node_modules/pixi.js/lib/scene/container/Container.d.ts:1195
Updates the transform properties of the container. Allows partial updates of transform properties for optimized manipulation.
Parameters
Section titled “Parameters”Partial<UpdateTransformOptions>
Transform options to update
Returns
Section titled “Returns”this
This container, for chaining
Example
Section titled “Example”// Basic transform updatecontainer.updateTransform({ x: 100, y: 200, rotation: Math.PI / 4});
// Scale and rotate around centersprite.updateTransform({ pivotX: sprite.width / 2, pivotY: sprite.height / 2, scaleX: 2, scaleY: 2, rotation: Math.PI});
// Update position onlybutton.updateTransform({ x: button.x + 10, // Move right y: button.y // Keep same y});- Container#setFromMatrix For matrix-based transforms
- Container#position For direct position access
Inherited from
Section titled “Inherited from”ViewContainer.updateTransform