Anime.js闪烁问题

时间:2018-02-05 14:26:11

标签: javascript animation anime.js

第二个动画将在第一个动画结束时闪烁。

问题是什么?

enter image description here

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);

https://codepen.io/cople/pen/jZrWLZ

0 个答案:

没有答案