reverse() V4
Forces the timer to play backward.
Returns
The timer itself
Can be chained with other timer methods.
reverse() code example
import { createTimer, utils } from 'animejs';
const [ $reverseButton ] = utils.$('.reverse');
const [ $time ] = utils.$('.time');
const timer = createTimer({
duration: 2000,
onUpdate: self => $time.innerHTML = self.iterationCurrentTime,
});
const reverseTimer = () => timer.reverse();
$reverseButton.addEventListener('click', reverseTimer);
<div class="large centered row">
<div class="half col">
<pre class="large log row">
<span class="label">iteration time</span>
<span class="time value lcd">0</span>
</pre>
</div>
</div>
<div class="medium row">
<fieldset class="controls">
<button class="button reverse">Reverse</button>
</fieldset>
</div>