SpriteComp
:The sprite component.
group
Component Types
draw
: Comp["draw"]sprite
: stringName of the sprite.
width
: numberWidth for sprite.
height
: numberHeight for sprite.
frame
: numberCurrent frame in the entire spritesheet.
animFrame
: numberCurrent frame in relative to the animation that is currently playing.
quad
: QuadThe rectangular area of the texture to render.
play
(anim: string, options?: SpriteAnimPlayOpt): voidPlay a piece of anim.
stop
(): voidStop current anim.
numFrames
(): numberGet total number of frames.
getCurAnim
(): SpriteCurAnim | nullGet the current animation data.
since
v3001.0
curAnim
(): string | undefinedGet current anim name.
deprecated
Use `getCurAnim().name` instead.
hasAnim
(name: string): booleanCheck if object's sprite has an animation.
getAnim
(name: string): SpriteAnim | nullGet an animation.
animSpeed
: numberSpeed multiplier for all animations (for the actual fps for an anim use .play("anim", { speed: 10 })).
flipX
: booleanFlip texture horizontally.
flipY
: booleanFlip texture vertically.
onAnimStart
(action: (anim: string) => void): KEventControllerRegister an event that runs when an animation is played.
onAnimEnd
(action: (anim: string) => void): KEventControllerRegister an event that runs when an animation is ended.
renderArea
(): Rectsince
v3000.0