Class Sprite
Hierarchy
-
ThinSprite
- Sprite
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates a new Sprite
Parameters
-
name: string
defines the name
-
manager: ISpriteManager
defines the manager
Returns Sprite
-
Properties
action ManagerSearch playground for actionManager
Gets or sets the associated action manager
angleSearch playground for angle
Gets or sets rotation angle
animationsSearch playground for animations
Gets the list of attached animations
cell IndexSearch playground for cellIndex
Gets or sets the cell index in the sprite sheet
cell RefSearch playground for cellRef
Gets or sets the cell reference in the sprite sheet, uses sprite's filename when added to sprite sheet
colorSearch playground for color
Gets or sets the main color
dispose When Finished AnimatingSearch playground for disposeWhenFinishedAnimating
Gets or sets a boolean indicating that this sprite should be disposed after animation ends
heightSearch playground for height
Gets or sets the height
invertUSearch playground for invertU
Gets or sets a boolean indicating if UV coordinates should be inverted in U axis
invertVSearch playground for invertV
Gets or sets a boolean indicating if UV coordinates should be inverted in B axis
is PickableSearch playground for isPickable
Gets or sets a boolean indicating if the sprite can be picked
is VisibleSearch playground for isVisible
Gets or sets a boolean indicating if the sprite is visible (renderable). Default is true
nameSearch playground for name
defines the name
on Dispose ObservableSearch playground for onDisposeObservable
An event triggered when the control has been disposed
positionSearch playground for position
Gets or sets the current world position
unique IdSearch playground for uniqueId
Gets or sets the unique id of the sprite
use Alpha For PickingSearch playground for useAlphaForPicking
Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default)
widthSearch playground for width
Gets or sets the width
Accessors
animation Started
-
Returns a boolean indicating if the animation is started
Returns boolean
delay
-
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
-
from Index
-
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
-
loop Animation
-
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
-
Gets or sets the sprite size
Returns number
-
Gets or sets the sprite size
Parameters
-
value: number
Returns any
-
to Index
-
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
-
Release associated resources
Returns void
get Class NameSearch playground for getClassName
-
Returns the string "Sprite"
Returns string
"Sprite"
play AnimationSearch playground for playAnimation
-
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
-
Serializes the sprite to a JSON object
Returns any
the JSON object
stop AnimationSearch playground for stopAnimation
-
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
-
Class used to represent a sprite
https://doc.babylonjs.com/babylon101/sprites