如何从TexturePacker为EaselJS创建正确的Spritesheet导出?导出后,我得到这样的东西...

{
"images": ["textures.png"],
"frames": [
    [818, 44, 42, 42],
    [818, 1, 42, 42],
    [775, 87, 42, 42],
    [775, 44, 42, 42],
    [775, 1, 42, 42],
    [732, 87, 42, 42],
    [732, 44, 42, 42],
    [732, 1, 42, 42],
    [689, 87, 42, 42],
    [689, 44, 42, 42]
],
"animations": {
        "load_indicator_01":[0],
        "load_indicator_02":[1],
        "load_indicator_03":[2],
        "load_indicator_04":[3],
        "load_indicator_05":[4],
        "load_indicator_06":[5],
        "load_indicator_07":[6],
        "load_indicator_08":[7],
        "load_indicator_09":[8],
        "load_indicator_10":[9]
},
"texturepacker": [
        "SmartUpdateHash: $TexturePacker:SmartUpdate:9148c4d9cc1b277627212fb0bffcda4d:fabda013c371507b8fb93d52f15735a0:205920eec6ac5ad8b6794732cd49ae1d$",
        "Created with TexturePacker (http://www.texturepacker.com) for EaselJS"
]
}


每帧都被定义为毫无意义的动画。这个出口商只是在开玩笑吗,或者我该如何正确导出EaselJS?有技巧吗?

最佳答案

基本上,它的格式Easyljs要求spritesheet
您将执行下一个:

$.getJSON("sprites.json", function(json) {
    spriteSheet = new createjs.SpriteSheet(json);
});


并针对您的情况为每个框架创建一个变量:

var load_indicator_01 = new createjs.Sprite(spriteSheet, "load_indicator_01");


自动执行此代码段:

var spriteSheet;
var sprites = {}
$.getJSON("sprites.json", function(json) {
    spriteSheet = new createjs.SpriteSheet(json);
    for(var sprite in json.animations){
        sprites[sprite] = new createjs.Sprite(spriteSheet, sprite);
    }
});


`

关于json - TexturePacker的EaselJS Spritesheets,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21778102/

10-10 23:57