[0]spine 播放错乱
templet: Laya.SpineTemplet;
skeleton: Laya.SpineSkeleton;
index = 0;
private startFun(): void {
//创建动画模板
this.templet = new Laya.SpineTemplet();
this.templet.loadAni("spine/10101001.json");
this.templet.on(Laya.Event.COMPLETE, this, this.parseComplete);
this.templet.on(Laya.Event.ERROR, this, this.onError);
}
private parseComplete(): void {
this.skeleton = this.templet.buildArmature();
Laya.stage.addChild(this.skeleton);
this.skeleton.pos(Laya.Browser.width / 2, Laya.Browser.height / 2 + 100);
//this.skeleton.scale(0.5, 0.5);
this.skeleton.on(Laya.Event.STOPPED, this, this.play);
this.play();
}
private onError() {
console.error("load spine error");
}
private play(): void {
console.log("1111111111");
if (++this.index >= this.skeleton.getAnimNum()) {
this.index = 0;
}
this.skeleton.play(this.index, false, true);
}
正常示例
没有找到相关结果
已邀请:
要回复问题请先登录
5 个回复
Laya_z
赞同来自:
136*****205
赞同来自:
都勾选了
Laya_z
赞同来自:
136*****205
赞同来自:
找到问题了,IDE 生成了图集,读取的是图集,所以spine显示错误了
136*****205
赞同来自:
这里有个问题,每次f12发布后,类库的顺序都要调转,不然类库初始化失败
laya.spine.js 依赖了 spine-core-3.7.js, spine-core-3.7.js必须放前面