Constructor
new SpritePartition(sprite, bounds)
Create a new sprite partition.
Members
height
Get the height of the sprite.
width
Get the width of the sprite.
Methods
copy() → {SpritePartition}
Get a copy of the sprite partition.
Returns:
Copied sprite partition
- Type:
- SpritePartition
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 |