Spine与DragonBone骨骼动画的转换
在ide的工具栏中
代码加载
Laya.init(1280,720,Laya.WebGL);
//直接创建骨骼动画
// this.skeleton = new Laya.Skeleton();
// Laya.stage.addChild(this.skeleton);
// this.skeleton.load("res/goblins-mesh.sk",Laya.Handler.create(this,onComplete),1);
//模板创建骨骼动画
this.templet = new Laya.Templet();
this.templet.loadAni("res/goblins-mesh.sk");
this.templet.on(Laya.Event.COMPLETE,this,onLoaded);
function onLoaded(){
// this.skeleton = this.templet.buildArmature(1);
this.skeleton = new Laya.Skeleton(this.templet,1);
Laya.stage.addChild(this.skeleton);
this.skeleton.pos(300,400);
this.skeleton.showSkinByIndex(1);
this.skeleton.play(0,true);
this.skeleton1 = new Laya.Skeleton(this.templet,1);
Laya.stage.addChild(this.skeleton1);
this.skeleton1.pos(600,400);
this.skeleton1.showSkinByIndex(2);
this.skeleton1.play(0,true);
}
function onComplete(){
this.skeleton.pos(300,400);
this.skeleton.showSkinByIndex(2);
}