Skip to content

stadium / Exports / LoopSprite

Class: LoopSprite

ImageSprite에 반복되는 이미지를 표시할 수 있게 해주는 Hook입니다.

ts
const sprite = new ImageSprite({ ... });
const sheet = {
    idle: ["idle1.png", "idle2.png", "idle3.png"],
    fly: ["fly1.png", "fly2.png", "fly3.png"],
}
const loop = new LoopSprite(sheet, 100)

sprite.use([ loop ])
loop.state = "fly";

Hierarchy

Table of contents

Constructors

Accessors

Constructors

constructor

new LoopSprite(sheet, interval?): LoopSprite

LoopSprite를 생성합니다. 생성자가 호출될 때, 시트에 있는 모든 이미지를 미리 로드합니다.

Parameters

NameTypeDefault valueDescription
sheetSpriteSheetundefined스프라이트 시트
intervalnumber200이미지 전환 간격

Returns

LoopSprite

Overrides

Hook.constructor

Defined in

lib/hook/loopSprite.ts:34

Accessors

state

set state(value): void

보여줄 시트의 상태를 설정합니다.

ts
loop.state = "fly";

Parameters

NameTypeDescription
valuestring상태 값

Returns

void

Defined in

lib/hook/loopSprite.ts:59