unvt / sprite-one

MIT License
13 stars 6 forks source link

Add tests, fixtures, use bin-pack for matrix calculation #14

Closed keichan34 closed 1 year ago

keichan34 commented 1 year ago

I tried fixing #11 by trying to understand the logic in matrix.ts, but I wasn't able to fix it. Doing a quick search, I found this tool: https://github.com/twolfson/spritesmith, which details its layout algorithms here. The default binary-tree algorithm uses the bin-pack module, which seems to work pretty well when integrated in sprite-one.

I also added a couple unit tests for matrix.ts, and added snapshot tests (by comparing the MD5 hashes of the outputs) to tests/lib/index.test.ts

Fixes #11