Skip to content

Documentation / spryte / Layer

Class: Layer ​

Defined in: layer.ts:24

Sprites recorded once with draw.record() and drawn again with draw.replay(), for things that don't change from frame to frame: a tilemap, a background, a level's scenery. On WebGL2 a replay is a few draw calls however many sprites the layer holds, instead of the per-sprite work of drawing them again.

A layer keeps the sprite images it was recorded with. Change a tile, and record the layer again.

Accessors ​

size ​

Get Signature ​

get size(): number

Defined in: layer.ts:35

How many sprites it draws.

Returns ​

number

Methods ​

dispose() ​

dispose(): void

Defined in: layer.ts:45

Free its GPU buffers. Replaying it afterwards builds them again.

Returns ​

void