ANIMATION > CALLBACKS
onUpdate
Executes a function on every frames of a running animation at the specified frameRate.
Accepts
A Function whose first argument is the animation itself
Default
noop
INFO
To change the default value globally, update the engine.defaults object.
import { engine } from 'animejs';
engine.defaults.onUpdate = self => console.log(self.id);
import { animate, utils } from 'animejs';
const [ $value ] = utils.$('.value');
let updates = 0;
const animation = animate('.circle', {
x: '16rem',
loopDelay: 1500,
loop: true,
alternate: true,
onUpdate: self => $value.textContent = ++updates
});
<div class="value">0</div>
<div class="circle"></div>