为什么GSAP连续连续点击会冻结动画?

问题描述

例如,我在单击时运行动画,但是如果我单击按钮,则动画将冻结一次,但是运行速度非常快,而动画运行一次。为什么会这样?

我的JS:

gsap.from(".tab-wrapper-item__Box h3",{
        duration: 0.3,x: "-100%",opacity: 0,scale: 0,ease: "circ.out",});
      gsap.from(".tab-wrapper-item__Box p",{
        duration: 0.5,x: "100%",delay: 0.5,});
      gsap.from(".tab-wrapper-item img",y: "-100%",delay: 0.3,});
      gsap.from(".tab-wrapper-item__Box .btn",y: "100%",delay: 0.9,});

解决方法

您正在制作common GSAP mistakes之一。引用文章

此问题的解决方法很简单:使用.fromTo()。另外,您可以预先创建动画并使用控制方法。

我建议您阅读全文。

仅供参考,您更有可能在the GreenSock forums上更快地回答这类问题。