I can add animations to anime timeline using the timeline.add({parameters})
function. Is it possible to remove all the previously added animations and reset the whole timeline?
Thanks,
I can add animations to anime timeline using the timeline.add({parameters})
function. Is it possible to remove all the previously added animations and reset the whole timeline?
Thanks,
You can reset the timeline by calling the restart
method:
const tl = anime.timeline({
duration: 400,
easing: 'easeInOutQuad',
})
tl.add({
targets: '.box',
rotate: 360,
translateX: {
value: 400,
delay: 400,
}
})
document.querySelector('button').addEventListener('click', () => {
tl.restart();
});