duration

定义所有动画属性或特定属性的持续时间,以毫秒为单位。

接受

持续时间值高于 1e12 或等于 Infinity 时,将在内部钳制为 1e12(约 32 年)。

默认值

动画持续时间值(默认为 1000)。

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

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

duration 代码示例

import { animate } from 'animejs';

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