跳过主要内容

restart

restart(includeDelay:Boolean, suppressEvents:Boolean):self

重新启动并从开头开始向前播放。

参数

  • includeDelay:布尔值

    (默认值 =false) - 决定重新启动时是否遵守延迟(如果存在)。例如,如果一个补间动画有1秒的延迟,比如gsap.to(obj, {duration: 2, x: 100, delay: 1});然后之后restart()被调用,则它会立即开始,但restart(true)将导致延迟被遵守,因此它不会在接下来的1秒内开始。

  • suppressEvents:布尔值

    (默认值 =true) - 如果true(默认),当播放头移动到由time参数。

返回值:self

self(便于链式调用)

细节

重新启动并从开头开始向前播放。

//restarts, not including any delay that was defined
myAnimation.restart();

//restarts, including any delay, and doesn't suppress events during the initial move back to time:0
myAnimation.restart(true, false);
无噪 Logo
无噪文档
中文文档 · 复刻官网
查看所有 ↗