Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Zwoptex: Template for exporting zwoptex data in JSON format.
{"frames": {
{% for sprite in spritesAndAliases %}
"{{ sprite.name }}":
{
"frame": {"x":{{ sprite.textureRectX }},"y":{{ sprite.textureRectY }},"w":{{ sprite.textureRectWidth }},"h":{{ sprite.textureRectHeight }}},
"rotated": {% if sprite.isRotated %}true{% else %}false{% /if %},
"trimmed": {% if sprite.isTrimmed %}true{% else %}false{% /if %},
"spriteSourceSize": {"x":0,"y":0,"w":{{ sprite.sourceSizeWidth }},"h":{{ sprite.sourceSizeHeight }}},
"sourceSize": {"w":{{ sprite.sourceSizeWidth }},"h":{{ sprite.sourceSizeHeight }}},
"spriteColorRect": {"x":{{ sprite.sourceColorRectX }},"y":{{ sprite.sourceColorRectY }},"w":{{ sprite.sourceColorRectWidth }},"h":{{ sprite.sourceColorRectHeight }}},
"spriteOffset": {"x":{{ sprite.offsetX }}, "y":{{ sprite.offsetY }}},
"spriteSize": {"w":{{ sprite.sizeWidth }}, "h":{{ sprite.sizeHeight }}},
},{% /for %}},
"meta": {
"app": "http://zwoptexapp.com",
"version": "{{ metadata.version }}",
"image": "{{ metadata.target.textureFileName }}{{ metadata.target.textureFileExtension }}",
"size": {"w":{{ metadata.sizeWidth }},"h":{{ metadata.sizeHeight }}},
"name": "{{ metadata.name }}",
"premultipliedAlpha": {% if metadata.premultipliedAlpha %}true{% else %}false{% /if %},
"target":{
"name": "{{ metadata.target.name }}",
"textureFileName": "{{ metadata.target.textureFileName }}",
"textureFileExtension": "{{ metadata.target.textureFileExtension }}",
"coordinatesFileName": "{{ metadata.target.coordinatesFileName }}",
"coordinatesFileExtension": "{{ metadata.target.coordinatesFileExtension }}",
"premultipliedAlpha":{% if metadata.target.premultipliedAlpha %}true{% else %}false{% /if %}
},
"scale": "1",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment