Popmotion 立即结束补间并跳转到补间的末尾
Popmotion end a tween immediately and jump to the end of the tween
我有一个简单的补间:
const grass = styler(/* some element */)
const from = +grass.get('opacity')
const tweener = tween({from, to: 0, duration: 5000, ease: easing.linear}).start(v => grass.set('opacity', v))
如何让它跳到补间的末尾然后立即停止补间?例如,在这种情况下,跳转到 0 不透明度并停止补间?我知道我能做到:
grass.set('opacity', 0)
tweener.stop()
但我相信有更自然的解决方案。类似于:
tweener.jumpToEndAndStop()
TIA
基于https://code.tutsplus.com/tutorials/introduction-to-popmotion-part-1-tween--cms-30431我认为这就是我想要的:
tweener.seek(1)
tweener.stop()
我有一个简单的补间:
const grass = styler(/* some element */)
const from = +grass.get('opacity')
const tweener = tween({from, to: 0, duration: 5000, ease: easing.linear}).start(v => grass.set('opacity', v))
如何让它跳到补间的末尾然后立即停止补间?例如,在这种情况下,跳转到 0 不透明度并停止补间?我知道我能做到:
grass.set('opacity', 0)
tweener.stop()
但我相信有更自然的解决方案。类似于:
tweener.jumpToEndAndStop()
TIA
基于https://code.tutsplus.com/tutorials/introduction-to-popmotion-part-1-tween--cms-30431我认为这就是我想要的:
tweener.seek(1)
tweener.stop()