pause()
Pauses a running animation.
Returns
The animation itself
Can be chained with other animation methods.
pause() code example
import { animate, utils, stagger } from 'animejs';
const [ $pauseButton ] = utils.$('.pause');
const animation = animate('.square', {
x: '17rem',
alternate: true,
ease: 'inOutSine',
loop: true,
delay: stagger(100),
});
const pauseAnimation = () => animation.pause();
$pauseButton.addEventListener('click', pauseAnimation);
<div class="medium row">
<div class="square"></div>
</div>
<div class="medium row">
<div class="square"></div>
</div>
<div class="medium row">
<fieldset class="controls">
<button class="button pause">Pause</button>
</fieldset>
</div>