sheet(
src,opts) ->sheet,err
Create a sprite sheet (atlas) over a source image
Frames come from a tile grid or from explicit rects.
| opts field | description |
|---|---|
tile_w, tile_h | tile size; required without frames |
margin | border around the grid, default 0 |
spacing | gap between tiles, default 0 |
frames | an array of {x, y, w, h} rects, a map of name -> {x, y, w, h}, or both |
Grid frames count from 1, left to right, then top to bottom.
sheet:frame(index_or_name) returns the frame's sprite, or nil.
sheet:nframes() returns the count of numbered frames.