gsap,播放后恢复动画

gsap, revert animation after play

我想用 gsap 播放动画,但播放完后,我想重新设置它。就像那个动画播放完之后,reset,播放完了。无需点击任何地方或计算播放时间,休眠或等待过程。就像:

TweenLite.to(thing, 1, {x:'-20px'}).reset();

(理想情况下,gsap 中没有重置调用..如何实现?)

我无法让它与 .seek()、.time()、.pause() 一起使用。 那些总是打断动画。

最好我想使用简单的 TweenLite,或者如果必须的话,使用 TimelineLite。 几个小时以来我一直在搜索/寻找它..

有很多方法可以做到这一点,但这里有一个简单的方法:

TweenLite.to(thing, 1, {x:-20, onComplete:function() {
    this.pause(0); //seeks the tween (this) to 0 (playhead's starting position) and pauses immediately.
}});

有帮助吗?