延迟

定义动画属性开始时的延迟,单位为毫秒,可以全局设置或针对特定属性局部设置。

接受

默认值

动画延迟值(默认为 0)。

要全局更改默认值,请更新 engine.defaults 对象。

import { engine } from 'animejs';
engine.defaults.delay = 500;

延迟代码示例

import { animate } from 'animejs';

const animation = animate('.square', {
  x: '17rem',
  rotate: {
    to: 360,
    delay: 1000, // Local delay applied only to rotate property
  },
  delay: 500,  // Global delay applied to all properties
  loop: true,
  alternate: true
});
<div class="medium row">
  <div class="square"></div>
</div>