Google News
logo
Anime.js - Interview Questions
What are the PLAY/PAUSE Controls in Anime.js?
Plays a paused animation, or starts the animation if the autoplay parameters is set to false.
animation.play();
Pauses a running animation.
animation.pause();

 

Example : 
var animation = anime({
  targets: '.play-pause-demo .el',
  translateX: 270,
  delay: function(el, i) { return i * 100; },
  direction: 'alternate',
  loop: true,
  autoplay: false,
  easing: 'easeInOutSine'
});

document.querySelector('.play-pause-demo .play').onclick = animation.play;
document.querySelector('.play-pause-demo .pause').onclick = animation.pause;​
Advertisement