使用方法
let trackEntry = spComp.setAnimation(0, animName, false);
trackEntry.trackTime = trackEntry.animationEnd;
spComp.timeScale = -1;
完全不生效呀
使用方法
let trackEntry = spComp.setAnimation(0, animName, false);
trackEntry.trackTime = trackEntry.animationEnd;
spComp.timeScale = -1;
完全不生效呀
playSpineFrame(startFrame: number = 20, endFrame: number = 10) {
let skeleton = this.node.getComponent(sp.Skeleton);
if (startFrame > endFrame) skeleton.timeScale = -1;
else skeleton.timeScale = 1;
skeleton.setAnimation(0, "animation", false);
let frameRate = 30;
let duration = skeleton.getCurrent(0).animation.duration;
let frames = Math.ceil(frameRate * duration);
console.log(frames);
skeleton.getCurrent(0).animationStart = (startFrame / frames < 0 ? 0 : startFrame / frames) * duration;
skeleton.getCurrent(0).animationEnd = (endFrame / frames > 1 ? 1 : endFrame / frames) * duration;
}
const reversePlayback = () => {
if (!spComp.isValid) {
this.unschedule(reversePlayback);
return;
}
if (!spNode.active) {
this.unschedule(reversePlayback);
return;
}
entry.trackTime -= 1 / 30; // 每帧倒退
if (entry.trackTime <= 0) {
entry.trackTime = 0;
this.unschedule(reversePlayback);
}
};
this.schedule(reversePlayback, 0);
我搞了个这个方式, 容我试试这个你发的这个
好像不可以诶, 设置 -1 完全没有效果, 还是正序播放的
let skeleton = this.node.getComponent(sp.Skeleton);
skeleton.setAnimation(0, "animation", false);
skeleton.timeScale = -1;
let duration = skeleton.getCurrent(0).animation.duration;
skeleton.getCurrent(0).animationStart = duration;
这animationEnd不设置也罢
我测试了一下, 没有效果
感觉是 3.8.2 的问题
监听的log会被瞬间打出来 


真的是闹麻了 
刚试了一下3.8.2确实有问题,我一开始用的3.8.7
看了别的帖子 应该和这个有关系
ske.setAnimation(0, `${aniName}`, false).timeScale = -1;;
let track = ske.getState().tracks[0];
if (track) {
track.trackTime = track.animationEnd;
}
这个好使,牛的 
skeleton.setAnimation(0, “animation”, false).timeScale = -1;
把我这个代码改成这样也行 
卧槽 牛逼

能用,但是倒放不能循环播放
监听一下播放完毕的回调重新播放一遍呗
skeleton._accTime = XXX ,自己设置动画时间,想怎么播就怎么播 