【问题标题】:Javascript Raphael animations not showingJavascript Raphael 动画未显示
【发布时间】:2017-11-13 18:56:42
【问题描述】:

我有这个功能

function generateCircles2(){
    for(var i = 1; i<500; i++){
    var position = Math.floor(Math.random() * 600);
    var size = Math.floor(Math.random() * 8);
    var circle = paper.circle(-50,position,size);
    var time = Math.floor(Math.random() * 4000) + 2000;
    circle.attr("fill", "#000000");
    var cirAni = Raphael.animate({cy: position, cx: 850}, time);
    circle.animate(cirAni.delay(100));
  }
}

假设生成圆圈以在屏幕上随机点移动,但是圆圈不会出现,并且它还会阻止其他动画在这些动画的顶部发生。如何让这些圆圈随机移动,同时保持其他动画同时进行?

【问题讨论】:

    标签: javascript animation raphael


    【解决方案1】:

    这是因为正确的方法是动画对象的“动画”而不是“动画”(而不是动画元素)。

    所以不是

    var cirAni = Raphael.animate({cy: position, cx: 850}, time);
    

    切换到

    var cirAni = Raphael.animation({cy: position, cx: 850}, time);
    

    jsfiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-14
      • 1970-01-01
      • 2017-11-21
      • 1970-01-01
      • 2010-11-29
      • 1970-01-01
      • 1970-01-01
      • 2013-08-23
      相关资源
      最近更新 更多