Skip to content

uupaa/TextureAtlas.js

Repository files navigation

TextureAtlas.js Build Status

npm

Create texture atlas

Document

Run on

Browser and node-webkit

<script src="lib/TextureAtlas.js"></script>
<script>
var imageList = ["http://.../a.png", ...];
var sprite = new TextureAtlas();

TextureAtlas.imageLoader(imageList, function(images) {
    var canvas = document.createElement("canvas");
    var ctx = canvas.getContext("2d");

    for (var i = 0, iz = images.length; i < iz; ++i) {
        sprite.draw(images[i].src, ctx, i * 32, i * 32);
    }
}, function(error) {
    throw error;
}, function(image) {
    sprite.add(image.src, image);
});
</script>

About

Create texture atlas

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published