@spearwolf/twopoint5d
Version:
a library to create 2.5d realtime graphics and pixelart with three.js
13 lines • 576 B
JavaScript
import { TextureAtlas } from './TextureAtlas.js';
import { TextureCoords } from './TextureCoords.js';
export class TexturePackerJson {
static parse(data, parentCoords, target) {
target ??= new TextureAtlas();
parentCoords ??= new TextureCoords(0, 0, data.meta.size.w, data.meta.size.h);
for (const [name, { frame }] of Object.entries(data.frames)) {
target.add(name, new TextureCoords(parentCoords, frame.x, frame.y, frame.w, frame.h));
}
return [target, data.meta];
}
}
//# sourceMappingURL=TexturePackerJson.js.map