API

Class Sprite

Class used to represent a sprite

Hierarchy

  • ThinSprite
    • Sprite

Implements

Index
actionManager: Nullable<ActionManager>

Gets or sets the associated action manager

angle: number = 0

Gets or sets rotation angle

animations: Nullable<Animation[]> = ...

Gets the list of attached animations

cellIndex: number

Gets or sets the cell index in the sprite sheet

cellRef: string

Gets or sets the cell reference in the sprite sheet, uses sprite's filename when added to sprite sheet

color: Color4

Gets or sets the main color

disposeWhenFinishedAnimating: boolean

Gets or sets a boolean indicating that this sprite should be disposed after animation ends

height: number = 1.0

Gets or sets the height

invertU: boolean = false

Gets or sets a boolean indicating if UV coordinates should be inverted in U axis

invertV: boolean = false

Gets or sets a boolean indicating if UV coordinates should be inverted in B axis

isPickable: boolean = false

Gets or sets a boolean indicating if the sprite can be picked

isVisible: boolean = true

Gets or sets a boolean indicating if the sprite is visible (renderable). Default is true

name: string

defines the name

onDisposeObservable: Observable<Sprite> = ...

An event triggered when the control has been disposed

position: Vector3

Gets or sets the current world position

uniqueId: number

Gets or sets the unique id of the sprite

useAlphaForPicking: boolean = false

Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default)

width: number = 1.0

Gets or sets the width

  • get delay(): number

    Gets or sets the delay between cell changes (setting it will restart the animation)

    Returns number

  • set delay(value: number): void

    Gets or sets the delay between cell changes (setting it will restart the animation)

    Parameters

    • value: number

    Returns void

  • get fromIndex(): number

    Gets or sets the initial key for the animation (setting it will restart the animation)

    Returns number

  • set fromIndex(value: number): void

    Gets the initial key for the animation (setting it will restart the animation)

    Parameters

    • value: number

    Returns void

  • get loopAnimation(): boolean

    Gets or sets a boolean indicating if the animation is looping (setting it will restart the animation)

    Returns boolean

  • set loopAnimation(value: boolean): void

    Gets or sets a boolean indicating if the animation is looping (setting it will restart the animation)

    Parameters

    • value: boolean

    Returns void

  • get toIndex(): number

    Gets or sets the end key for the animation (setting it will restart the animation)

    Returns number

  • set toIndex(value: number): void

    Gets or sets the end key for the animation (setting it will restart the animation)

    Parameters

    • value: number

    Returns void

  • Starts an animation

    Parameters

    • from: number

      defines the initial key

    • to: number

      defines the end key

    • loop: boolean

      defines if the animation must loop

    • delay: number

      defines the start delay (in ms)

    • onAnimationEnd: Nullable<() => void> = null

      defines a callback to call when animation ends

    Returns void