Overview
A texture atlas is a container for smaller images, usually used to reduce the number of network requests and improve performance on WebGL.
Creating texture atlases
To create texture atlas you can use TexturePacker tool.
Installation
By TexturePacker does not include Black exporter and you have to install it manually.
To install exporter copy all files from https://github.com/MassiveHeights/Black/tree/master/TexturePacker/black
to
Windows %ProgramFiles%/CodeAndWeb/TexturePacker/bin/exporters/black
Mac Applications/TexturePacker.app/Contents/Resources/exporters
Then restart TexturePacker and select 'Black' as a data format.
How to use
To load an atlas:
assets.enqueueAtlas('atlas', 'atlas.png', 'atlas.json');
To create a sprite:
let sprite = new Sprite('image-name');
where image-name
is a file name of the image inside atlas without extension.
To learn more about supported formats please refer to TexturePacker site.