3

I'm a beginner in anime.js. I animate something and after the animations is complete i want to remove the element that i'm animating.

The animation is working perfect. I just can't remove the element that im working and i dont want to hide it

logoTimeline
.add({
        targets: text1,
        duration: 700,
        delay: function(el, index) { return index*50; },
        opacity: 1,

        easing: 'easeOutCirc',
        translateX: function(el, index) {
            return [(-50+index*10),0]
        },
        offset:0
    })
    .add({
        remove:text1
    })
Mart Cube
  • 77
  • 3
  • 10

1 Answers1

5

Per the API Documentation you need to add a complete callback function which will fire once the animation has completed:

logoTimeline
.add({
    targets: text1,
    duration: 700,
    delay: function(el, index) { return index*50; },
    opacity: 1,

    easing: 'easeOutCirc',
    translateX: function(el, index) {
        return [(-50+index*10),0]
    },
    offset:0,
    complete: function(anim) {
        logoTimeline.remove();
    }
});
M. Laing
  • 1,607
  • 11
  • 25