Class: SpriteAnimation
SpriteAnimation is used to define an animation as a series of materials to apply to a Sprite, with specifications on key frames, frame rate, and if the animation should repeat.
SpriteAnimation uses an array of key frames to iterate through for defining the materials to apply and for how long to apply them.
Table of contents
Constructors
Properties
Constructors
constructor
+ new SpriteAnimation(keyframes
: SpriteKeyFrame[], frameRate
: number, repeat
: number, durationSinceRepeat?
: number, repeatCount?
: number): SpriteAnimation
Parameters:
Name | Type | Default value |
---|---|---|
keyframes |
SpriteKeyFrame[] | - |
frameRate |
number | - |
repeat |
number | - |
durationSinceRepeat |
number | 0 |
repeatCount |
number | 0 |
Returns: SpriteAnimation
Properties
durationSinceRepeat
• durationSinceRepeat: number
State tracker, keeping track of the time since the animation has repeated.
frameRate
• frameRate: number
The frame rate of the animation in frames per second
keyframes
• keyframes: SpriteKeyFrame[]
Key frames to apply, each one specifies a material and duration of keyframe in frames.
repeat
• repeat: number
If the animation should repeat, a value of 0 means 0 repetitions and it will not repeat, a value of 5 means 5 repeats. A value of -1 means infinite repetitions.
repeatCount
• repeatCount: number
State tracker, keeping track of the number of times the animation has repeated.