JavaScript Object properties JS

Numerical and color JavaScript Object properties can be passed directly to the animation parameters.

JavaScript Object properties code example

import { animate, utils } from 'animejs';

const myObject = {
  number: 1337,
  unit: '42%',
}

const [ $log ] = utils.$('code');

animate(myObject, {
  number: 50,
  unit: '100%',
  modifier: utils.round(0),
  onRender: function() {
    $log.innerHTML = JSON.stringify(myObject);
  }
});
<pre class="row large centered">
  <code>{"number":1337,"unit":"42%"}</code>
</pre>