// 减少帧数
anime({
targets: '.animation',
translateX: 250,
easing: 'easeInOutQuad',
duration: 1000,
loop: true,
direction: 'alternate',
delay: function(el, i) {
return i * 10; // 控制动画元素的延迟
},
update: function(anim) {
if (anim.progress > 50) {
anim.pause() // 动画完成一半后暂停动画
}
}
});
// 减少元素数量
anime({
targets: '.animation',
translateX: 250,
easing: 'easeInOutQuad',
duration: 1000,
loop: true,
direction: 'alternate',
delay: function(el, i) {
return i * 10; // 控制动画元素的延迟
},
update: function(anim) {
if (anim.progress > 50) {
anim.pause();
}
}
});
anime({
targets: '.animation',
translateX: 250,
easing: 'easeInOutQuad',
duration: 1000,
loop: true,
direction: 'alternate',
delay: function(el, i) {
return i * 10;
},
update: function(anim) {
if (anim.progress > 50) {
anim.pause();
}
},
// 禁用硬件加速
begin: function(anim) {
anim.animatables.forEach(function(animatable) {
animatable.target.style.willChange = 'auto';
});
},
complete: function(anim) {
anim.animatables.forEach(function(animatable) {
animatable.target.style.willChange = 'auto';
});
}
});
// 启用优化过的 GPU 加速
anime({
targets: '.animation',
translateX: 250,
easing: 'easeInOutQuad',
duration: 1000,
loop: true,
direction: 'alternate',
delay: function(el, i) {
return i * 10;
},
update
上一篇:animeJS调用不存在的函数