Hierarchy

  • Sprite
    • Sprite

Implements

Constructors

Properties

Accessors

Methods

Constructors

Properties

_accessibleActive?: boolean
_accessibleDiv?: AccessibleHTMLElement
_anchor: ObservablePoint
_didSpriteUpdate: boolean
_filters?: {
    effect: FilterEffect;
    filterArea?: Rectangle;
    filters: readonly Filter[];
}

Type declaration

  • effect: FilterEffect
  • Optional filterArea?: Rectangle
  • filters: readonly Filter[]
_internalEventMode: EventMode
_localBoundsCacheData: LocalBoundsCacheData
_localBoundsCacheId: number
_mask?: {
    effect: Effect;
    mask: unknown;
}

Type declaration

  • effect: Effect
  • mask: unknown
_onRender: (() => void)

Type declaration

    • (): void
    • Returns void

_renderId?: number
_roundPixels: 0 | 1
_texture: Texture
_updateFlags: number
_zIndex: number
accessible?: boolean

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

Default

false
accessibleChildren?: boolean

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

Default

true
accessibleHint?: string

Sets the aria-label attribute of the shadow div

accessiblePointerEvents?: PointerEvents

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

Default

'auto'
accessibleTitle?: string

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

Member

accessibleType?: string

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

Default

'button'
allowChildren: boolean
batched: boolean
boundsArea: Rectangle

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. 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.

children: ContainerChild[]

The array of children of this container.

cullArea?: Rectangle

If set, this shape is used for culling instead of the bounds of this object. It can improve the culling performance of objects with many children. The culling area is defined in local space.

Memberof

scene.Container#

cullable?: boolean

Should this object be rendered if the bounds of this object are out of frame?

Culling has no effect on whether updateTransform is called.

Default

false

Memberof

scene.Container#

cullableChildren?: boolean

Determines if the children to the container can be culled Setting this to false allows PixiJS to bypass a recursive culling function Which can help to optimize very complex scenes

Default

true

Memberof

scene.Container#

cursor: string

The cursor preferred when the mouse pointer is hovering over.

depthOfChildModified: (() => void)

Type declaration

    • (): void
    • Returns void

destroy$: Subject<void> = ...

When Lifecycle Object is destroyed, it emits and closes this subject. Along with destroying his children, which in turn behave the same.

destroyed: boolean

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

didChange: boolean
didViewUpdate: boolean
effects?: Effect[]
eventMode: EventMode

The mode of interaction for this object

filterArea?: Rectangle
filters: Filter | Filter[]
gameObject: GameObject

Parent GameObject is assigned at creation.

groupAlpha: number
groupColor: number
groupColorAlpha: number
groupTransform: Matrix

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

hitArea: IHitArea

The hit-area specifies the area for which pointer events should be captured by this event target.

includeInBuild: boolean
interactive: boolean

Whether this event target should fire UI events.

interactiveChildren: boolean

Whether this event target has any children that need UI events. This can be used optimize event propagation.

isInteractive: (() => boolean)

Returns true if the Container has interactive 'static' or 'dynamic'

Type declaration

    • (): boolean
    • Returns boolean

isRenderGroupRoot: boolean
isSimple: boolean
label: string = 'Sprite'

Each Lifecycle Object has label for pixi debugging.

localAlpha: number
localColor: number
localTransform: Matrix

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

mask: number | Container<ContainerChild>
measurable: boolean
name: string

Deprecated

since 8.0.0

See

Container#label

onRender: (() => void)

Type declaration

    • (): void
    • Returns void

onclick: FederatedEventHandler<FederatedPointerEvent>

Handler for 'click' event

onglobalmousemove: FederatedEventHandler<FederatedPointerEvent>

Handler for 'globalmousemove' event

onglobalpointermove: FederatedEventHandler<FederatedPointerEvent>

Handler for 'globalpointermove' event

onglobaltouchmove: FederatedEventHandler<FederatedPointerEvent>

Handler for 'globaltouchmove' event

onmousedown: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mousedown' event

onmouseenter: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mouseenter' event

onmouseleave: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mouseleave' event

onmousemove: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mousemove' event

onmouseout: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mouseout' event

onmouseover: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mouseover' event

onmouseup: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mouseup' event

onmouseupoutside: FederatedEventHandler<FederatedPointerEvent>

Handler for 'mouseupoutside' event

onpointercancel: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointercancel' event

onpointerdown: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointerdown' event

onpointerenter: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointerenter' event

onpointerleave: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointerleave' event

onpointermove: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointermove' event

onpointerout: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointerout' event

onpointerover: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointerover' event

onpointertap: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointertap' event

onpointerup: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointerup' event

onpointerupoutside: FederatedEventHandler<FederatedPointerEvent>

Handler for 'pointerupoutside' event

onrightclick: FederatedEventHandler<FederatedPointerEvent>

Handler for 'rightclick' event

onrightdown: FederatedEventHandler<FederatedPointerEvent>

Handler for 'rightdown' event

onrightup: FederatedEventHandler<FederatedPointerEvent>

Handler for 'rightup' event

onrightupoutside: FederatedEventHandler<FederatedPointerEvent>

Handler for 'rightupoutside' event

ontap: FederatedEventHandler<FederatedPointerEvent>

Handler for 'tap' event

ontouchcancel: FederatedEventHandler<FederatedPointerEvent>

Handler for 'touchcancel' event

ontouchend: FederatedEventHandler<FederatedPointerEvent>

Handler for 'touchend' event

ontouchendoutside: FederatedEventHandler<FederatedPointerEvent>

Handler for 'touchendoutside' event

ontouchmove: FederatedEventHandler<FederatedPointerEvent>

Handler for 'touchmove' event

ontouchstart: FederatedEventHandler<FederatedPointerEvent>

Handler for 'touchstart' event

onwheel: FederatedEventHandler<FederatedWheelEvent>

Handler for 'wheel' event

parent: Container<ContainerChild>

The display object container that contains this display object.

relativeGroupTransform: Matrix

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

relativeRenderGroupDepth: number
renderGroup: RenderGroup
renderPipeId: "sprite" = "sprite"
sortChildren: (() => void)

Type declaration

    • (): void
    • Returns void

sortDirty: boolean
sortableChildren: boolean
tabIndex?: number

Default

0
uid: number
update$: Subject<number> = ...

When Lifecycle Object is updated, it emits this subject. Along with updating his children, which in turn behave the same.

zIndex: number
prefixed: string | boolean

Accessors

  • get alpha(): number
  • The opacity of the object.

    Returns number

  • set alpha(value): void
  • Parameters

    • value: number

    Returns void

  • get anchor(): ObservablePoint
  • 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.

    Returns ObservablePoint

    Example

    import { Sprite } from 'pixi.js';

    const sprite = new Sprite({texture: Texture.WHITE});
    sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).
  • set anchor(value): void
  • Parameters

    • value: number | PointData

    Returns void

  • get 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.

    Returns number

  • set angle(value): void
  • Parameters

    • value: number

    Returns void

  • get blendMode(): BLEND_MODES
  • The blend mode to be applied to the sprite. Apply a value of 'normal' to reset the blend mode.

    Returns BLEND_MODES

    Default

    'normal'
    
  • set blendMode(value): void
  • Parameters

    • value: BLEND_MODES

    Returns void

  • get bounds(): BoundsData
  • The local bounds of the sprite.

    Returns BoundsData

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

    Returns number

  • set height(value): void
  • Parameters

    • value: number

    Returns void

  • get isRenderGroup(): boolean
  • 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

    Returns boolean

  • set isRenderGroup(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isRenderable(): boolean
  • Whether or not the object should be rendered.

    Returns boolean

  • get pivot(): ObservablePoint
  • 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).

    Returns ObservablePoint

    Since

    4.0.0

  • set pivot(value): void
  • Parameters

    • value: number | PointData

    Returns void

  • get position(): ObservablePoint
  • The coordinate of the object relative to the local coordinates of the parent.

    Returns ObservablePoint

    Since

    4.0.0

  • set position(value): void
  • Parameters

    • value: PointData

    Returns void

  • get renderable(): boolean
  • Can this object be rendered, if false the object will not be drawn but the transform will still be updated.

    Returns boolean

  • set renderable(value): void
  • Parameters

    • value: boolean

    Returns void

  • get 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.

    Returns number

  • set rotation(value): void
  • Parameters

    • value: number

    Returns void

  • get roundPixels(): boolean
  • Whether or not to round the x/y position of the sprite.

    Returns boolean

  • set roundPixels(value): void
  • Parameters

    • value: boolean

    Returns void

  • get scale(): ObservablePoint
  • The scale factors of this object along the local coordinate axes.

    The default scale is (1, 1).

    Returns ObservablePoint

    Since

    4.0.0

  • set scale(value): void
  • Parameters

    • value: number | PointData

    Returns void

  • get skew(): ObservablePoint
  • The skew factor for the object in radians.

    Returns ObservablePoint

    Since

    4.0.0

  • set skew(value): void
  • Parameters

    • value: PointData

    Returns void

  • get sourceBounds(): BoundsData
  • The bounds of the sprite, taking the texture's trim into account.

    Returns BoundsData

  • get texture(): Texture
  • The texture that the sprite is using.

    Returns Texture

  • set texture(value): void
  • Parameters

    • value: Texture

    Returns void

  • get tint(): number
  • The tint applied to the sprite. This is a hex value.

    A value of 0xFFFFFF will remove any tint effect.

    Returns number

    Default

    0xFFFFFF
    
  • set tint(value): void
  • Parameters

    • value: ColorSource

    Returns void

  • get visible(): boolean
  • The visibility of the object. If false the object will not be drawn, and the transform will not be updated.

    Returns boolean

  • set visible(value): void
  • Parameters

    • value: boolean

    Returns void

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

    Returns number

  • set width(value): void
  • Parameters

    • value: number

    Returns void

  • get worldTransform(): Matrix
  • Current transform of the object based on world (parent) factors.

    Returns Matrix

  • get x(): number
  • The position of the container on the x axis relative to the local coordinates of the parent. An alias to position.x

    Returns number

  • set x(value): void
  • Parameters

    • value: number

    Returns void

  • get y(): number
  • The position of the container on the y axis relative to the local coordinates of the parent. An alias to position.y

    Returns number

  • set y(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Parameters

    • height: number
    • localHeight: number

    Returns void

  • Parameters

    • width: number
    • localWidth: number

    Returns void

  • Adds the bounds of this object to the bounds object.

    Parameters

    • bounds: Bounds

      The output bounds object.

    Returns void

  • Adds one or more children to the container.

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

    Type Parameters

    • U extends ContainerChild[]

    Parameters

    • Rest ...children: U

      The Container(s) to add to the container

    Returns U[0]

    • The first child that was added.
  • Type Parameters

    • U extends Container<ContainerChild, U>

    Parameters

    • child: U
    • index: number

    Returns U

  • Parameters

    • effect: Effect

    Returns void

  • Type Parameters

    • K extends (keyof FederatedEventMap) | (keyof GlobalFederatedEventMap)

    Parameters

    • type: K
    • listener: ((e) => any)
        • (e): any
        • Parameters

          • e: AllFederatedEventMap[K]

          Returns any

    • Optional options: AddListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: AddListenerOptions

    Returns void

  • Type Parameters

    • T extends string | number | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ContainerEvents<ContainerChild> & AnyEvent>[Extract<T, string | number | symbol>]

          Returns void

    • Optional context: any

    Returns this

  • Checks if the object contains the given point.

    Parameters

    • point: PointData

      The point to check

    Returns boolean

  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    Parameters

    • event: Event

    Returns boolean

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

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • event: T
    • Rest ...args: ArgumentMap<ContainerEvents<ContainerChild> & AnyEvent>[Extract<T, string | number | symbol>]

    Returns boolean

  • This enables the container to be rendered as a render group.

    Returns void

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

    Returns (string | number | symbol)[]

  • Parameters

    • Optional skipUpdate: boolean
    • Optional bounds: Bounds

    Returns Bounds

  • Type Parameters

    • U extends Container<ContainerChild, U>

    Parameters

    • index: number

    Returns U

  • Parameters

    • label: string | RegExp
    • Optional deep: boolean

    Returns Container<ContainerChild>

  • Parameters

    • label: string | RegExp
    • Optional deep: boolean

    Returns Container<ContainerChild>

  • Parameters

    • child: ContainerChild

    Returns number

  • Parameters

    • label: string | RegExp
    • Optional deep: boolean
    • Optional out: Container<ContainerChild>[]

    Returns Container<ContainerChild>[]

  • Parameters

    • Optional point: Point
    • Optional skipUpdate: boolean

    Returns Point

  • Parameters

    • Optional bounds: Bounds

    Returns Bounds

  • Retrieves the size of the Sprite as a [Size]Size object. This is faster than get the width and height separately.

    Parameters

    • Optional out: Size

      Optional object to store the size in.

    Returns Size

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

    Parameters

    • event: string | number | symbol

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Type Parameters

    • T extends string | number | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ContainerEvents<ContainerChild> & AnyEvent>[Extract<T, string | number | symbol>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ContainerEvents<ContainerChild> & AnyEvent>[Extract<T, string | number | symbol>]

          Returns void

    • Optional context: any

    Returns this

  • Returns void

  • Add a one-time listener for a given event.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ContainerEvents<ContainerChild> & AnyEvent>[Extract<T, string | number | symbol>]

          Returns void

    • Optional context: any

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | number | symbol

    Returns this

  • Removes one or more children from the container.

    Type Parameters

    • U extends ContainerChild[]

    Parameters

    • Rest ...children: U

      The Container(s) to remove

    Returns U[0]

    The first child that was removed.

  • Type Parameters

    • U extends Container<ContainerChild, U>

    Parameters

    • index: number

    Returns U

  • Parameters

    • Optional beginIndex: number
    • Optional endIndex: number

    Returns ContainerChild[]

  • Parameters

    • effect: Effect

    Returns void

  • Type Parameters

    • K extends (keyof FederatedEventMap) | (keyof GlobalFederatedEventMap)

    Parameters

    • type: K
    • listener: ((e) => any)
        • (e): any
        • Parameters

          • e: AllFederatedEventMap[K]

          Returns any

    • Optional options: RemoveListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: RemoveListenerOptions

    Returns void

  • Returns void

  • Remove the listeners of a given event.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ContainerEvents<ContainerChild> & AnyEvent>[Extract<T, string | number | symbol>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Parameters

    • child: ContainerChild
    • index: number

    Returns void

  • Updates the local transform using the given matrix.

    Parameters

    • matrix: Matrix

      The matrix to use for updating the transform.

    Returns void

  • Sets the size of the Sprite to the specified width and height. This is faster than setting the width and height separately.

    Parameters

    • value: number | Optional<Size, "height">

      This can be either a number or a [Size]Size object.

    • Optional height: number

      The height to set. Defaults to the value of width if not provided.

    Returns void

  • Type Parameters

    • U extends Container<ContainerChild, U>

    Parameters

    • child: U
    • child2: U

    Returns void

  • Type Parameters

    • P extends PointData = Point

    Parameters

    • position: PointData
    • Optional point: P
    • Optional skipUpdate: boolean

    Returns P

  • Type Parameters

    • P extends PointData = Point

    Parameters

    • position: PointData
    • Optional from: Container<ContainerChild>
    • Optional point: P
    • Optional skipUpdate: boolean

    Returns P

  • Updates the Lifecycle Object with actual deltaTime ~60fps

    Parameters

    • deltaTime: number

    Returns void

  • Updates the local transform.

    Returns void

  • Updates the transform properties of the container (accepts partial values).

    Parameters

    • opts: Partial<UpdateTransformOptions>

      The options for updating the transform.

    Returns this

  • Helper function that creates a new sprite based on the source you provide. The source can be - frame id, image, video, canvas element, video element, texture

    Parameters

    • source: any

      Source to create texture from

    • Optional skipCache: boolean

      Whether to skip the cache or not

    Returns Sprite

    The newly created sprite

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

    Parameters

    • source: Dict<any>

      The source of properties and methods to mix in.

    Returns void