inherited PIXI.Container

Hierarchy

  • Container
    • PixiTextContainer

Constructors

Properties

_accessibleActive: boolean

PIXI.DisplayObject#

Needs docs.

_accessibleDiv: boolean

PIXI.DisplayObject#

Needs docs.

_bounds: Bounds

The bounds object, this is used to calculate and store the bounds of the displayObject.

PIXI.DisplayObject#_bounds

_boundsID: number

Flags the cached bounds as dirty.

PIXI.DisplayObject#_boundsID

_boundsRect: Bounds

Cache of this display-object's bounds-rectangle.

PIXI.DisplayObject#_boundsRect

_destroyed: boolean

If the object has been destroyed via destroy(). If true, it should not be used.

PIXI.DisplayObject#_destroyed

_enabledFilters: Filter[]

Currently enabled filters

PIXI.DisplayObject#_enabledFilters

_lastSortedIndex: number

Which index in the children array the display component was before the previous zIndex sort. Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.

PIXI.DisplayObject#_lastSortedIndex

_localBounds: Bounds

Local bounds object, swapped with _bounds when using getLocalBounds().

PIXI.DisplayObject#_localBounds

_localBoundsRect: Bounds

Cache of this display-object's local-bounds rectangle.

PIXI.DisplayObject#_localBoundsRect

_mask: null | Container | MaskData

The original, cached mask of the object.

PIXI.DisplayObject#_mask

_tempDisplayObjectParent: Container
_zIndex: number

The zIndex of the displayObject. A higher value will mean it will be rendered on top of other displayObjects within the same container.

PIXI.DisplayObject#_zIndex

accessible: boolean

Flag for if the object is accessible. If true AccessibilityManager will overlay a shadow div with attributes set

PIXI.DisplayObject#

accessibleChildren: boolean

Setting to false will prevent any children inside this container to be accessible. Defaults to true.

PIXI.DisplayObject#

true
accessibleHint: string

Sets the aria-label attribute of the shadow div

PIXI.DisplayObject#

accessiblePointerEvents: string

Specify the pointer-events the accessible div will use Defaults to auto.

PIXI.DisplayObject#

'auto'
accessibleTitle: string

Sets the title attribute of the shadow div If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'

PIXI.DisplayObject#

accessibleType: string

Specify the type of div the accessible layer is. Screen readers treat the element differently depending on this type. Defaults to button.

PIXI.DisplayObject#

'button'
alpha: number

The opacity of the object.

PIXI.DisplayObject#alpha

angle: number

The angle of the object in degrees. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.

buttonMode: boolean

If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive Setting this changes the 'cursor' property to 'pointer'.

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.buttonMode = true;

PIXI.DisplayObject#

cacheAsBitmap: boolean

Set this to true if you want this display object to be cached as a bitmap. This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. To remove simply set this property to false

IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.

PIXI.DisplayObject#

children: DisplayObject[]

The array of children of this container.

PIXI.Container#children

cursor: string

This defines what cursor mode is used when the mouse cursor is hovered over the displayObject.

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.cursor = 'wait';

PIXI.DisplayObject#

filterArea: Rectangle

The area the filter is applied to. This is used as more of an optimization rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.

Also works as an interaction mask.

PIXI.DisplayObject#filterArea

filters: Filter[]

Sets the filters for the displayObject.

  • IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. To remove filters simply set this property to 'null'.

PIXI.DisplayObject#filters

height: number

The height of the Container, setting this will actually modify the scale to achieve the value set

hitArea: IHitArea

Interaction shape. Children will be hit first, then this shape will be checked. Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);

PIXI.DisplayObject#

interactive: boolean

Enable interaction events for the DisplayObject. Touch, pointer and mouse events will not be emitted unless interactive is set to true.

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.on('tap', (event) => {
//handle event
});

PIXI.DisplayObject#

interactiveChildren: boolean

Determines if the children to the displayObject can be clicked/touched Setting this to false allows PixiJS to bypass a recursive hitTest function

PIXI.Container#

isMask: boolean

Does any other displayObject use this object as a mask?

PIXI.DisplayObject#isMask

isSprite: boolean

used to fast check if a sprite is.. a sprite!

PIXI.DisplayObject#isSprite

localTransform: Matrix

Current transform of the object based on local factors: position, scale, other stuff.

mask: null | Container | MaskData

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. In PixiJS a regular mask must be a PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it utilities shape clipping. To remove a mask, set this property to null.

For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.

const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF3300);
graphics.drawRect(50, 250, 100, 100);
graphics.endFill();

const sprite = new PIXI.Sprite(texture);
sprite.mask = graphics;

At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.

name: string

The instance name of the object.

PIXI.DisplayObject#

name

parent: Container

The display object container that contains this display object.

PIXI.DisplayObject#parent

pivot: ObservablePoint

The pivot point of the displayObject that it rotates around. Assignment by value since pixi-v4.

position: ObservablePoint

The coordinate of the object relative to the local coordinates of the parent. Assignment by value since pixi-v4.

renderable: boolean

Can this object be rendered, if false the object will not be drawn but the updateTransform methods will still be called.

Only affects recursive calls from parent. You can ask for bounds manually.

PIXI.DisplayObject#renderable

rotation: number

The rotation of the object in radians. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.

scale: ObservablePoint

The scale factor of the object. Assignment by value since pixi-v4.

skew: ObservablePoint

The skew factor for the object in radians. Assignment by value since pixi-v4.

sortableChildren: boolean

If set to true, the container will sort its children by zIndex value when updateTransform() is called, or manually if sortChildren() is called.

This actually changes the order of elements in the array, so should be treated as a basic solution that is not performant compared to other solutions, such as

PIXI.settings.SORTABLE_CHILDREN

PIXI.Container#sortableChildren

sortDirty: boolean

Should children be sorted by zIndex at the next updateTransform call. Will get automatically set to true if a new child is added, or if a child's zIndex changes.

PIXI.Container#sortDirty

transform: Transform

World transform and local transform of this object. This will become read-only later, please do not assign anything there unless you know what are you doing.

PIXI.DisplayObject#transform

visible: boolean

The visibility of the object. If false the object will not be drawn, and the updateTransform function will not be called.

Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.

PIXI.DisplayObject#visible

width: number

The width of the Container, setting this will actually modify the scale to achieve the value set

worldAlpha: number

The multiplied alpha of the displayObject.

PIXI.DisplayObject#worldAlpha

worldTransform: Matrix

Current transform of the object based on world (parent) factors.

worldVisible: boolean

Indicates if the object is globally visible.

x: number

The position of the displayObject on the x axis relative to the local coordinates of the parent. An alias to position.x

y: number

The position of the displayObject on the y axis relative to the local coordinates of the parent. An alias to position.y

zIndex: number

The zIndex of the displayObject. If a container has the sortableChildren property set to true, children will be automatically sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, and thus rendered on top of other displayObjects within the same container.

Accessors

Methods

  • Protected

    Recalculates the bounds of the object. Override this to calculate the bounds of the specific object (not including children).

    Returns void

  • Recursively updates transform of all objects from the root to this one internal function for toLocal()

    Returns void

  • Protected

    To be overridden by the subclasses.

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Adds one or more children to the container.

    Multiple items can be added like so: myContainer.addChild(thingOne, thingTwo, thingThree)

    Type Parameters

    • TChildren extends DisplayObject[]

    Parameters

    • ...children: TChildren

      The DisplayObject(s) to add to the container

    Returns TChildren[0]

    The first child that was added.

  • Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown

    Type Parameters

    • T extends DisplayObject

    Parameters

    • child: T

      The child to add

    • index: number

      The index to place the child in

    Returns T

    The child that was added.

  • Parameters

    • event: InteractionEventTypes
    • fn: (event: InteractionEvent) => void
    • Optionalcontext: any

    Returns this

  • Parameters

    • event: string | symbol
    • fn: Function
    • Optionalcontext: any

    Returns this

  • Recalculates the bounds of the container.

    Returns void

  • Container default updateTransform, does update children of container. Will crash if there's no parent element.

    Returns void

    PIXI.Container#

    containerUpdateTransform

  • Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

    Parameters

    • Optionaloptions: { baseTexture?: boolean; children?: boolean; texture?: boolean }

      Options parameter. A boolean will act as if all options have been set to that value

      • OptionalbaseTexture?: boolean

        Only used for child Sprites if options.children is set to true Should it destroy the base texture of the child sprite

      • Optionalchildren?: boolean

        if set to true, all the children will have their destroy method called as well. 'options' will be passed on to those calls.

      • Optionaltexture?: boolean

        Only used for child Sprites if options.children is set to true Should it destroy the texture of the child sprite

    Returns void

  • Pair method for enableTempParent

    Parameters

    • cacheParent: DisplayObject

      actual parent of element

    Returns void

  • DisplayObject default updateTransform, does not update children of container. Will crash if there's no parent element.

    Returns void

    PIXI.DisplayObject#

    displayObjectUpdateTransform

  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    • ...args: any[]

      Arguments that are passed to registered listeners

    Returns boolean

    true if the event had listeners, else false.

  • Used in Renderer, cacheAsBitmap and other places where you call an updateTransform on root

    const cacheParent = elem.enableTempParent();
    elem.updateTransform();
    elem.disableTempParent(cacheParent);

    Returns DisplayObject

    current parent

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

  • Retrieves the bounds of the displayObject as a rectangle object.

    Parameters

    • OptionalskipUpdate: 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.

    • Optionalrect: Rectangle

      Optional rectangle to store the result of the bounds calculation.

    Returns Rectangle

    The rectangular bounding area.

  • Returns the child at the specified index

    Parameters

    • index: number

      The index to get the child at

    Returns DisplayObject

    The child at the given index, if any.

  • Returns the display object in the container.

    Recursive searches are done in a preorder traversal.

    Parameters

    • name: string

      Instance name.

    • Optionaldeep: boolean

      Whether to search recursively

    Returns DisplayObject

    The child with the specified name.

    getChildByName

    PIXI.Container#

  • Returns the index position of a child DisplayObject instance

    Parameters

    • child: DisplayObject

      The DisplayObject instance to identify

    Returns number

    The index position of the child display object to identify

  • Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.

    Parameters

    • Optionalpoint: Point

      The point to write the global value to.

    • OptionalskipUpdate: 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.

    Returns Point

    The updated point.

    getGlobalPosition

    PIXI.DisplayObject#

  • Retrieves the local bounds of the displayObject as a rectangle object.

    Parameters

    • Optionalrect: Rectangle

      Optional rectangle to store the result of the bounds calculation.

    • OptionalskipChildrenUpdate: boolean

      Setting to true will stop re-calculation of children transforms, it was default behaviour of pixi 4.0-5.2 and caused many problems to users.

    Returns Rectangle

    The rectangular bounding area.

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

      The event name.

    Returns number

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    Returns Function[]

  • Parameters

    • event: string
    • Optionalfn: Function
    • Optionalcontext: any

    Returns this

  • Parameters

    • event: "removed" | "added"
    • fn: (displayObject: DisplayObject) => void
    • Optionalcontext: any

    Returns this

  • Parameters

    • event: string
    • fn: Function
    • Optionalcontext: any

    Returns this

  • Parameters

    • event: "removed" | "added"
    • fn: (displayObject: DisplayObject) => void
    • Optionalcontext: any

    Returns this

  • Parameters

    • event: string
    • fn: Function
    • Optionalcontext: any

    Returns this

  • Protected

    Overridable method that can be used by Container subclasses whenever the children array is modified

    Returns void

  • Parameters

    • Optionalevent: InteractionEventTypes

    Returns this

  • Parameters

    • Optionalevent: string | symbol

    Returns this

  • Removes one or more children from the container.

    Type Parameters

    • TChildren extends DisplayObject[]

    Parameters

    • ...children: TChildren

      The DisplayObject(s) to remove

    Returns TChildren[0]

    The first child that was removed.

  • Removes a child from the specified index position.

    Parameters

    • index: number

      The index to get the child from

    Returns DisplayObject

    The child that was removed.

  • Removes all children from this container that are within the begin and end indexes.

    Parameters

    • OptionalbeginIndex: number

      The beginning position.

    • OptionalendIndex: number

      The ending position. Default value is size of the container.

    Returns DisplayObject[]

    List of removed children

  • Parameters

    • event: InteractionEventTypes
    • Optionalfn: (event: InteractionEvent) => void
    • Optionalcontext: any

    Returns this

  • Parameters

    • event: string | symbol
    • Optionalfn: Function
    • Optionalcontext: any

    Returns this

  • Renders the object using the WebGL renderer

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Protected

    Render the object using the WebGL renderer and advanced features.

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Changes the position of an existing child in the display object container

    Parameters

    • child: DisplayObject

      The child DisplayObject instance for which you want to change the index number

    • index: number

      The resulting index number for the child display object

    Returns void

  • Set the parent Container of this DisplayObject.

    Parameters

    • container: Container

      The Container to add this DisplayObject to.

    Returns Container

    The Container that this DisplayObject was added to.

  • Convenience function to set the position, scale, skew and pivot at once.

    Parameters

    • Optionalx: number

      The X position

    • Optionaly: number

      The Y position

    • OptionalscaleX: number

      The X scale value

    • OptionalscaleY: number

      The Y scale value

    • Optionalrotation: number

      The rotation

    • OptionalskewX: number

      The X skew value

    • OptionalskewY: number

      The Y skew value

    • OptionalpivotX: number

      The X pivot value

    • OptionalpivotY: number

      The Y pivot value

    Returns DisplayObject

    The DisplayObject instance

  • Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.

    Returns void

  • Swaps the position of 2 Display Objects within this container.

    Parameters

    • child: DisplayObject

      First display object to swap

    • child2: DisplayObject

      Second display object to swap

    Returns void

  • Calculates the global position of the display object.

    Parameters

    • position: IPointData

      The world origin to calculate from.

    • Optionalpoint: Point

      A Point object in which to store the value, optional (otherwise will create a new Point).

    • OptionalskipUpdate: boolean

      Should we skip the update transform.

    Returns Point

    A point object representing the position of this object.

  • Calculates the local position of the display object relative to another point.

    Parameters

    • position: IPointData

      The world origin to calculate from.

    • Optionalfrom: DisplayObject

      The DisplayObject to calculate the global position from.

    • Optionalpoint: Point

      A Point object in which to store the value, optional (otherwise will create a new Point).

    • OptionalskipUpdate: boolean

      Should we skip the update transform

    Returns Point

    A point object representing the position of this object

  • Updates the transform on all children of this container for rendering

    Returns void

  • Mixes all enumerable properties and methods from a source object to DisplayObject.

    Parameters

    • source: any

      The source of properties and methods to mix in.

    Returns void