revert()

Cancels the timer,sets its currentTime to 0 and reverts the linked onScroll() instance if necessary.

Use .revert() when you want to completely stop and destroy an timer.

Returns

The timer itself

Can be chained with other timer methods.

revert() code example

import { createTimer, utils } from 'animejs';

const [ $playButton ] = utils.$('.play');
const [ $revertButton ] = utils.$('.revert');
const [ $time ] = utils.$('.time');

const timer = createTimer({
  onUpdate: self => $time.innerHTML = self.currentTime
});

const playTimer = () => timer.play();
const revertTimer = () => {
  timer.revert();
  $time.innerHTML = timer.currentTime
}

$playButton.addEventListener('click', playTimer);
$revertButton.addEventListener('click', revertTimer);
<div class="large centered row">
  <div class="half col">
    <pre class="large log row">
      <span class="label">current time</span>
      <span class="time value lcd">0</span>
    </pre>
  </div>
</div>
<div class="medium row">
  <fieldset class="controls">
    <button class="button play">Play</button>
    <button class="button revert">Revert</button>
  </fieldset>
</div>