admin管理员组

文章数量:1391995

I'm a beginner in anime.js. I animate something and after the animations is plete 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
    })

I'm a beginner in anime.js. I animate something and after the animations is plete 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
    })
Share Improve this question edited Nov 28, 2017 at 20:33 Mart Cube asked Nov 28, 2017 at 20:20 Mart CubeMart Cube 773 silver badges10 bronze badges 1
  • If you want to add up something to the detail of the question then use the edit button below the Question. – Muhammad Omer Aslam Commented Nov 28, 2017 at 20:26
Add a ment  | 

1 Answer 1

Reset to default 5

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

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,
    plete: function(anim) {
        logoTimeline.remove();
    }
});

本文标签: javascripthow to remove element in animejsStack Overflow