The sprite component.
group
Component Types
draw: Comp["draw"]
Name of the sprite.
Width for sprite.
Height for sprite.
Current frame in the entire spritesheet.
Current frame in relative to the animation that is currently playing.
The rectangular area of the texture to render.
play(anim: string, options?: SpriteAnimPlayOpt): void
Play a piece of anim.
Stop current anim.
Get total number of frames.
getCurAnim(): SpriteCurAnim | null
Get the current animation data.
since
v3001.0
curAnim(): string | undefined
Get current anim name.
deprecated
Use `getCurAnim().name` instead.
hasAnim(name: string): boolean
Check if object's sprite has an animation.
getAnim(name: string): SpriteAnim | null
Get an animation.
Speed multiplier for all animations (for the actual fps for an anim use .play("anim", { speed: 10 })).
Flip texture horizontally.
Flip texture vertically.
onAnimStart(action: (anim: string)=>void): KEventController
Register an event that runs when an animation is played.
onAnimEnd(action: (anim: string)=>void): KEventController
Register an event that runs when an animation is ended.
since
v3000.0