我是 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();
}
});
关于javascript - 如何删除 anime.js 中的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47540251/