Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Container3D<EventTypes, EventTypes>

A container represents a collection of 3D objects.

Type parameters

  • EventTypes: string | symbol

  • EventTypes: string | symbol

Hierarchy

Index

Constructors

constructor

Properties

Protected _height

_height: number

Protected _width

_width: number

children

children: DisplayObject[]

containerUpdateTransform

containerUpdateTransform: () => void

Type declaration

    • (): void
    • Returns void

parent

parent: Container

sortDirty

sortDirty: boolean

sortableChildren

sortableChildren: boolean

transform

transform: Transform3D = new Transform3D()

Static prefixed

prefixed: string | boolean

Accessors

height

  • get height(): number
  • set height(value: number): any
  • The height of the Container, setting this will actually modify the scale to achieve the value set

    member

    {number}

    Returns number

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

    Parameters

    • value: number

    Returns any

localTransform

position

rotationQuaternion

scale

width

  • get width(): number
  • set width(value: number): any
  • The width of the Container, setting this will actually modify the scale to achieve the value set

    member

    {number}

    Returns number

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

    Parameters

    • value: number

    Returns any

worldTransform

z

  • get z(): number
  • set z(value: number): void
  • The position of the object on the z axis relative to the local coordinates of the parent.

    Returns number

  • The position of the object on the z axis relative to the local coordinates of the parent.

    Parameters

    • value: number

    Returns void

Methods

Protected _calculateBounds

  • _calculateBounds(): void
  • Recalculates the content bounds of this object. This should be overriden to calculate the bounds of this specific object (not including children).

    Returns void

Protected _render

  • _render(_renderer: Renderer): void
  • To be overridden by the subclasses.

    Parameters

    • _renderer: Renderer

    Returns void

addChild

  • addChild<T>(...children: T): T[0]
  • Adds one or more children to the container.

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

    Type parameters

    • T: DisplayObject[]

    Parameters

    • Rest ...children: T

      The DisplayObject(s) to add to the container

    Returns T[0]

    The first child that was added.

addChildAt

  • addChildAt<T>(child: T, index: number): T
  • 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: DisplayObject

    Parameters

    • child: T

      The child to add

    • index: number

      The index to place the child in

    Returns T

    The child that was added.

addListener

  • addListener(event: EventTypes, fn: ListenerFn, context?: any): this

calculateBounds

  • calculateBounds(): void
  • Recalculates the bounds of the container.

    This implementation will automatically fit the children's bounds into the calculation. Each child's bounds is limited to its mask's bounds or filterArea, if any is applied.

    Returns void

destroy

  • destroy(options?: IDestroyOptions | boolean): void
  • Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

    Parameters

    • Optional options: IDestroyOptions | boolean

    Returns void

emit

  • emit(event: EventTypes, ...args: Array<any>): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: EventTypes
    • Rest ...args: Array<any>

    Returns boolean

eventNames

  • eventNames(): Array<EventTypes>
  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<EventTypes>

getChildAt

  • getChildAt(index: number): DisplayObject
  • 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.

getChildIndex

  • getChildIndex(child: DisplayObject): number
  • 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

getLocalBounds

  • getLocalBounds(rect?: Rectangle, skipChildrenUpdate?: undefined | false | true): Rectangle
  • Retrieves the local bounds of the displayObject as a rectangle object.

    Calling getLocalBounds may invalidate the _bounds of the whole subtree below. If using it inside a render() call, it is advised to call getBounds() immediately after to recalculate the world bounds of the subtree.

    Parameters

    • Optional rect: Rectangle
    • Optional skipChildrenUpdate: undefined | false | true

    Returns Rectangle

    The rectangular bounding area.

listenerCount

  • listenerCount(event: EventTypes): number

listeners

off

  • off(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: undefined | false | true): this
  • Parameters

    • event: EventTypes
    • Optional fn: EventEmitter.ListenerFn
    • Optional context: any
    • Optional once: undefined | false | true

    Returns this

on

  • on(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

Protected onChildrenChange

  • onChildrenChange(_length?: undefined | number): void
  • Overridable method that can be used by Container subclasses whenever the children array is modified

    Parameters

    • Optional _length: undefined | number

    Returns void

once

  • once(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a one-time listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

removeAllListeners

removeChild

  • removeChild<T>(...children: T): T[0]
  • Removes one or more children from the container.

    Type parameters

    • T: DisplayObject[]

    Parameters

    • Rest ...children: T

      The DisplayObject(s) to remove

    Returns T[0]

    The first child that was removed.

removeChildAt

  • removeChildAt(index: number): DisplayObject
  • 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.

removeChildren

  • removeChildren(beginIndex?: undefined | number, endIndex?: undefined | number): DisplayObject[]
  • Removes all children from this container that are within the begin and end indexes.

    Parameters

    • Optional beginIndex: undefined | number
    • Optional endIndex: undefined | number

    Returns DisplayObject[]

    List of removed children

removeListener

  • removeListener(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: undefined | false | true): this
  • Remove the listeners of a given event.

    Parameters

    • event: EventTypes
    • Optional fn: EventEmitter.ListenerFn
    • Optional context: any
    • Optional once: undefined | false | true

    Returns this

render

  • render(renderer: Renderer): void
  • Renders the object using the WebGL renderer.

    The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the container itself. This render method will invoke it, and also invoke the render methods of all children afterward.

    If renderable or visible is false or if worldAlpha is not positive, this implementation will entirely skip rendering. See {@link PIXI.DisplayObject} for choosing between renderable or visible. Generally, setting alpha to zero is not recommended for purely skipping rendering.

    When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is advised to employ culling to automatically skip rendering objects outside of the current screen. The @pixi-essentials/cull and pixi-cull packages do this out of the box.

    The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or filtering is applied on a container. This does, however, break batching and can affect performance when masking and filtering is applied extensively throughout the scene graph.

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

Protected renderAdvanced

  • renderAdvanced(renderer: Renderer): void
  • Render the object using the WebGL renderer and advanced features.

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

setChildIndex

  • setChildIndex(child: DisplayObject, index: number): 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

sortChildren

  • sortChildren(): void
  • Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex.

    Returns void

swapChildren

  • swapChildren(child: DisplayObject, child2: DisplayObject): 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

updateTransform

  • updateTransform(): void
  • Updates the transform on all children of this container for rendering

    Returns void

Generated using TypeDoc