第二个动画将在第一个动画结束时闪烁。
问题是什么?
function animateParticules(x, y, duration) {
var particules = [];
for (var i = 0; i < numberOfParticules; i++) {
particules.push(createParticule(x, y));
}
anime.timeline().add({
targets: particules,
x: function(p) { return p.endPos.x; },
y: function(p) { return p.endPos.y; },
radius: 0.1,
duration: duration || anime.random(1200, 1800),
easing: 'linear',
update: renderParticule
});
}
var render = anime({
duration: Infinity,
update: function() {
ctx.clearRect(0, 0, canvasEl.width, canvasEl.height);
}
});
animateParticules(100, 100, 2e3);
animateParticules(400, 400, 4e3);