new LayeredSprite(sprites)
Create a new sprite partition.
Parameters:
| Name | Type | Description |
|---|---|---|
sprites | Array.<SpritePartition> | Sprite partitions to draw |
Members
height
Get the height of the sprite.
width
Get the width of the sprite.
Methods
draw(ctx, pos, size)
Draw the sprite.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
ctx | CanvasRenderingContext2D | ||
pos | Vec2 | Position/offset to draw sprite at | |
size | Vec2 | | null | Custom size of drawn sprite (or null to use default) |
update(elapsed)
Update the sprite.
Parameters:
| Name | Type | Description |
|---|---|---|
elapsed | number | Time since last update cycle in seconds |