eagle预览spine插件
This commit is contained in:
1 parent
3d72e88d88
commit
91815a355b
27 files changed
+70424
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
const fs=require('fs');
|
||||
const path=require('path');
|
||||
const utils=require('./js/spine-utils.js');
|
||||
const render=require('./js/spine-render.js');
|
||||
const base='/Users/tianmokeji/Desktop/特效/特效.library/images';
|
||||
// 找一个有效的 json
|
||||
const j=base+'/MTS9A4QKK0ALE.info/spineboy-pro.json';
|
||||
const a=utils.discoverAssets(j);
|
||||
if(!a.skeletonPath){console.log('未找到骨骼');process.exit(1);}
|
||||
console.log('使用骨骼:', a.skeletonPath);
|
||||
console.log('图集:', a.atlasPath);
|
||||
(async()=>{
|
||||
const v=utils.detectVersion(a.skeletonPath);
|
||||
const rd=utils.chooseRuntimeDir(v,a.isBinary);
|
||||
console.log('version:', v, 'runtimeDir:', rd);
|
||||
const spine=render.loadRuntime(rd);
|
||||
const atlas=await render.buildTextureAtlas(spine, fs.readFileSync(a.atlasPath,'utf8'), path.dirname(a.skeletonPath), a.texturePaths);
|
||||
const sd=render.readSkeletonData(spine, a.skeletonPath, atlas, a.isBinary);
|
||||
console.log('动画数量:', sd.animations.length);
|
||||
for(const anim of sd.animations){
|
||||
console.log(' - '+anim.name+' duration='+anim.duration+'s');
|
||||
}
|
||||
if(sd.animations[0]){
|
||||
console.log('第一个动画名:', sd.animations[0].name, ' duration:', sd.animations[0].duration);
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user