Reputation: 86
Really I would like to reverse a keyframe animation using THREE.KeyFrameAnimation.update
with a negative number, appreciate this isn't supported natively, has anyone got any advice?
Upvotes: 3
Views: 1565
Reputation: 13125
I actually found a solution to this for when you only want to play it once. I posted the full class here:
The important bit is:
// will force the mixer to play in reverse no matter what
playClipReverseByIndex_Forced(index) {
this.action = this.mixer.clipAction(this.animations[index]);
if(this.action.time === 0) {
this.action.time = this.action.getClip().duration;
}
this.action.paused = false;
this.action.setLoop(THREE.LoopOnce);
this.action.timeScale = -1;
this.action.play();
}
Upvotes: 3
Reputation: 546
Try setting animation.timeScale = -1;
But it works only when animation.loop = true;
Upvotes: 2