Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PostProcessingSprite<EventTypes, EventTypes>

Represents a sprite which has post processing effects. Can be used for rendering 3D objects as 2D sprites.

Type parameters

  • EventTypes: string | symbol

  • EventTypes: string | symbol

Hierarchy

  • Sprite
    • PostProcessingSprite

Index

Constructors

constructor

  • new PostProcessingSprite(renderer: Renderer, options?: PostProcessingSpriteOptions): PostProcessingSprite
  • Creates a new post processing sprite using the specified options.

    Parameters

    • renderer: Renderer

      The renderer to use.

    • Optional options: PostProcessingSpriteOptions

      The options for the render texture. If both width and height has not been set, it will automatically be resized to the renderer size.

    Returns PostProcessingSprite

Properties

Protected _anchor

_anchor: ObservablePoint

_cachedTint

_cachedTint: number

_height

_height: number

Private _renderTexture

_renderTexture: RenderTexture

_texture

_texture: Texture

_textureID

_textureID: number

Protected _textureTrimmedID

_textureTrimmedID: number

_tintRGB

_tintRGB: number

_width

_width: number

blendMode

blendMode: BLEND_MODES

indices

indices: Uint16Array

pluginName

pluginName: string

renderer

renderer: Renderer

The renderer to use.

Protected uvs

uvs: Float32Array

Protected vertexData

vertexData: Float32Array

Static prefixed

prefixed: string | boolean

Accessors

anchor

  • get anchor(): ObservablePoint
  • set anchor(value: ObservablePoint): any
  • The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|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

    const sprite = new PIXI.Sprite(texture); sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).

    member

    {PIXI.ObservablePoint}

    Returns ObservablePoint

  • The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|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.

    Parameters

    • value: ObservablePoint

    Returns any

depthTexture

  • get depthTexture(): undefined | BaseTexture<Resource, ISize | ICubeResourceOptions | IImageResourceOptions | ISVGResourceOptions | IVideoResourceOptions | {}>
  • The depth texture.

    Returns undefined | BaseTexture<Resource, ISize | ICubeResourceOptions | IImageResourceOptions | ISVGResourceOptions | IVideoResourceOptions | {}>

height

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

    member

    {number}

    Returns number

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

    Parameters

    • value: number

    Returns any

renderTexture

  • get renderTexture(): RenderTexture

roundPixels

  • get roundPixels(): boolean
  • set roundPixels(value: boolean): any
  • If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. Advantages can include sharper image quality (like text) and faster rendering on canvas. The main disadvantage is movement of objects may appear less smooth. To set the global default, change {@link PIXI.settings.ROUND_PIXELS}

    Returns boolean

  • If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. Advantages can include sharper image quality (like text) and faster rendering on canvas. The main disadvantage is movement of objects may appear less smooth. To set the global default, change {@link PIXI.settings.ROUND_PIXELS}

    member

    {boolean}

    default

    false

    Parameters

    • value: boolean

    Returns any

texture

  • get texture(): Texture
  • set texture(value: Texture): any
  • The texture that the sprite is using

    member

    {PIXI.Texture}

    Returns Texture

  • The texture that the sprite is using

    Parameters

    • value: Texture

    Returns any

tint

  • get tint(): number
  • set tint(value: number): any
  • The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.

    member

    {number}

    default

    0xFFFFFF

    Returns number

  • The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.

    Parameters

    • value: number

    Returns any

width

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

    member

    {number}

    Returns number

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

    Parameters

    • value: number

    Returns any

Methods

Protected _calculateBounds

  • _calculateBounds(): void

Protected _onTextureUpdate

  • _onTextureUpdate(): void
  • When the texture is updated, this event will fire to update the scale and frame

    Returns void

Protected _render

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

    Parameters

    • renderer: Renderer

      The webgl renderer to use.

    Returns void

addListener

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

calculateTrimmedVertices

  • calculateTrimmedVertices(): void
  • calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData This is used to ensure that the true width and height of a trimmed texture is respected

    Returns void

calculateVertices

  • calculateVertices(): void

containsPoint

  • containsPoint(point: IPointData): boolean
  • Tests if a point is inside this sprite

    Parameters

    • point: IPointData

      the point to test

    Returns boolean

    the result of the test

destroy

  • destroy(options?: IDestroyOptions | boolean): void
  • Destroys this sprite and optionally its texture and children

    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>

getLocalBounds

  • getLocalBounds(rect?: Rectangle): Rectangle
  • Gets the local bounds of the sprite object.

    Parameters

    • Optional rect: Rectangle

    Returns Rectangle

    The bounds.

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

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

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

renderObject

  • renderObject(object: DisplayObject): void

Static from

  • from(source: SpriteSource, options?: IBaseTextureOptions): Sprite
  • Helper function that creates a new sprite based on the source you provide. The source can be - frame id, image url, video url, canvas element, video element, base texture

    static

    Parameters

    • source: SpriteSource

      Source to create texture from

    • Optional options: IBaseTextureOptions

    Returns Sprite

    The newly created sprite

Generated using TypeDoc