我正在尝试调整 Spritesheet 导出的 JSON 文件,以便我可以导入 Sprite 及其在它们的注册点的位置。
在 Flash 中,我只是将 offset 添加到 position 中,这是 frame.offsetInSource
但这不起作用...这是我现在如何导出它:
function frameExport(frame)
{
var s;
if (hitFrame)
s = "\n,{\n";
else
s = "\n{\n";
s += AddKeyRect("frame", frame.frame);
s+= ",\n";
var spriteSourceSize = new Object();
spriteSourceSize.x = frame.offsetInSource.x;
spriteSourceSize.y = frame.offsetInSource.y;
spriteSourceSize.w = frame.sourceSize.w;
spriteSourceSize.h = frame.sourceSize.h;
s += AddKeyRect("offset", spriteSourceSize);
s += "}";
hitFrame = true;
return s;
}
我怎样才能以好的方式导出它,使它们的相对位置也导出为偏移变量? 还有其他变量可以用于此吗? 我知道您可以使用这些变量:
frame.frame.x
frame.frame.y
frame.frame.w
frame.frame.h
frame.offsetInSource.x
frame.offsetInSource.y
frame.sourceSize.w
frame.sourceSize.h
提前致谢!
最佳答案
我还尝试使用 Sprite Sheet Exporter 来导出每一帧的相对位置。但我发现,在元数据中,“frame.offsetInSource.x”的值始终为零。我想这就是我想要的,也是你想要的。
我尝试编辑 JSON.plugin.jsfl,取消注释。遗憾的是它仍然是零。
到现在为止,我还没有弄明白为什么。
关于flash - Flash CS6 Spritesheet导出功能中如何设置注册点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11925100/