Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to represent a sprite

see

https://doc.babylonjs.com/babylon101/sprites

Hierarchy

Implements

Index

Constructors

Properties

actionManager: Nullable<ActionManager>

Gets or sets the associated action manager

angle: number

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

Gets or sets the height

invertU: boolean

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

invertV: boolean

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

isPickable: boolean

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

isVisible: boolean

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

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

width: number

Gets or sets the width

Accessors

  • get animationStarted(): boolean
  • Returns a boolean indicating if the animation is started

    Returns boolean

  • get delay(): number
  • set delay(value: number): void
  • Gets or sets the delay between cell changes (setting it will restart the animation)

    Returns number

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

    Parameters

    • value: number

    Returns void

  • get fromIndex(): number
  • set fromIndex(value: number): void
  • Gets or sets the initial key for the animation (setting it will restart the animation)

    Returns number

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

    Parameters

    • value: number

    Returns void

  • get loopAnimation(): boolean
  • set loopAnimation(value: boolean): void
  • Gets or sets a boolean indicating if the animation is looping (setting it will restart the animation)

    Returns boolean

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

    Parameters

    • value: boolean

    Returns void

  • Gets the manager of this sprite

    Returns ISpriteManager

  • get size(): number
  • set size(value: number): void
  • Gets or sets the sprite size

    Returns number

  • Gets or sets the sprite size

    Parameters

    • value: number

    Returns void

  • get toIndex(): number
  • set toIndex(value: number): void
  • Gets or sets the end key for the animation (setting it will restart the animation)

    Returns number

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

    Parameters

    • value: number

    Returns void

Methods

  • dispose(): void
  • Release associated resources

    Returns void

  • getClassName(): string
  • Returns the string "Sprite"

    Returns string

    "Sprite"

  • playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd?: Nullable<() => void>): 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)

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

      defines a callback to call when animation ends

    Returns void

  • serialize(): any
  • Serializes the sprite to a JSON object

    Returns any

    the JSON object

  • stopAnimation(): void
  • Stops current animation (if any)

    Returns void

  • Parses a JSON object to create a new sprite

    Parameters

    • parsedSprite: any

      The JSON object to parse

    • manager: SpriteManager

      defines the hosting manager

    Returns Sprite

    the new sprite

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme