我使用spine3.8.75导出的文件无法使用。代码是使用的2.12.2beta1引擎示例的源码。
var Browser = Laya.Browser;
var WebGL = Laya.WebGL;
var Stage = Laya.Stage;
var Event = Laya.Event;
var Stat = Laya.Stat;
var SpineTemplet = Laya.SpineTemplet;
class SpineBinary {
constructor() {
this.aniPath = "res/powerup-pro.skel";
this.index = -1;
// Laya.init(Browser.width, Browser.height, WebGL);
// Laya.stage.scaleMode = Stage.SCALE_NOSCALE;
// Laya.stage.bgColor = "#232628";
// Stat.show();
this.startFun();
}
startFun() {
this.templet = new SpineTemplet(Laya.SpineVersion.v3_8);
this.templet.loadAni(this.aniPath);
this.templet.on(Event.COMPLETE, this, this.parseComplete);
this.templet.on(Event.ERROR, this, this.onError);
}
parseComplete() {
this.skeleton = this.templet.buildArmature();
Laya.stage.addChild(this.skeleton);
this.skeleton.pos(laya_width/2,laya_height/2);
this.skeleton.scale(0.5, 0.5);
this.skeleton.on(Event.STOPPED, this, this.play);
this.play();
}
onError() {
console.log("parse error");
}
play() {
console.log("1111111111");
if (++this.index >= this.skeleton.getAnimNum()) {
this.index = 0;
}
this.skeleton.play(0, false, true);
}
}
new SpineBinary;
使用官方示例的动画文件能正常显示,自己用3.8.75生成的不能显示,我把文件上传到了附件附件:
Spine3.8_.75示例动画_.rar