JKdreaming
12/7/2018 - 5:01 AM

Animating Two Elements in Anime JS

The sample code below shows one way in which you can animate two elements, in this case two images, in succession: the second animation starts once the first animation has completed.

var kickBall = anime({
  targets: '.kick',
  scale: 1.2,
  duration: 300,
  easing: 'easeInCubic',
  complete: function() {
    anime({
      targets: '.ball',
      translateX: '70vw',
      scale: 1.5,
      easing: 'easeOutBounce',
      delay: 150
    });
  }
});