Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Sprite

Class used to represent a sprite

see

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

Hierarchy

Implements

Index

Constructors

constructor

Properties

actionManagerSearch playground for actionManager

actionManager: Nullable<ActionManager>

Gets or sets the associated action manager

angleSearch playground for angle

angle: number

Gets or sets rotation angle

animationsSearch playground for animations

animations: Nullable<Array<Animation>>

Gets the list of attached animations

cellIndexSearch playground for cellIndex

cellIndex: number

Gets or sets the cell index in the sprite sheet

cellRefSearch playground for cellRef

cellRef: string

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

colorSearch playground for color

color: Color4

Gets or sets the main color

disposeWhenFinishedAnimatingSearch playground for disposeWhenFinishedAnimating

disposeWhenFinishedAnimating: boolean

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

heightSearch playground for height

height: number

Gets or sets the height

invertUSearch playground for invertU

invertU: boolean

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

invertVSearch playground for invertV

invertV: boolean

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

isPickableSearch playground for isPickable

isPickable: boolean

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

isVisibleSearch playground for isVisible

isVisible: boolean

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

nameSearch playground for name

name: string

defines the name

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<Sprite>

An event triggered when the control has been disposed

positionSearch playground for position

position: Vector3

Gets or sets the current world position

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the sprite

useAlphaForPickingSearch playground for useAlphaForPicking

useAlphaForPicking: boolean

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

widthSearch playground for width

width: number

Gets or sets the width

Accessors

animationStarted

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

    Returns boolean

delay

  • get delay(): number
  • set delay(value: number): any
  • 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 any

fromIndex

  • get fromIndex(): number
  • set fromIndex(value: number): any
  • 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 any

loopAnimation

  • get loopAnimation(): boolean
  • set loopAnimation(value: boolean): any
  • 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 any

manager

  • Gets the manager of this sprite

    Returns ISpriteManager

size

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

    Returns number

  • Gets or sets the sprite size

    Parameters

    • value: number

    Returns any

toIndex

  • get toIndex(): number
  • set toIndex(value: number): any
  • 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 any

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Release associated resources

    Returns void

getClassNameSearch playground for getClassName

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

    Returns string

    "Sprite"

playAnimationSearch playground for playAnimation

  • 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

serializeSearch playground for serialize

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

    Returns any

    the JSON object

stopAnimationSearch playground for stopAnimation

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

    Returns void

Static ParseSearch playground for Parse

  • 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
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method