Mar*_*ube 3 javascript animation 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
})
Run Code Online (Sandbox Code Playgroud)
根据API 文档,您需要添加一个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();
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7008 次 |
| 最近记录: |