如何删除 anime.js 中的元素?
how to remove element in anime.js?
我是 anime.js 的初学者。我制作了一些动画,在动画完成后我想删除我正在制作动画的元素。
动画效果完美。我只是无法删除我正在工作的元素,我不想隐藏它
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
})
根据 API Documentation,您需要添加一个 complete
回调函数,该函数将在动画完成后触发:
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();
}
});
我是 anime.js 的初学者。我制作了一些动画,在动画完成后我想删除我正在制作动画的元素。
动画效果完美。我只是无法删除我正在工作的元素,我不想隐藏它
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
})
根据 API Documentation,您需要添加一个 complete
回调函数,该函数将在动画完成后触发:
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();
}
});