Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove element in anime.js?

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
    })
like image 805
Mart Cube Avatar asked Dec 19 '25 15:12

Mart Cube


1 Answers

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();
    }
});
like image 145
M. Laing Avatar answered Dec 23 '25 23:12

M. Laing



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!