【发布时间】:2017-11-14 19:12:34
【问题描述】:
我有这个代码,但是动画的延迟只是从动画的开始,并且圆圈的生成并没有分散,因为它们都是同时出现的。
function generateCircles2(){
if (totalDelay < 110){
totalDelay += 1;
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.animation({cy: position, cx: 850}, time, generateCircles3());
circle.animate(cirAni.delay(100));
}
}
function generateCircles3(){
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.animation({cy: position, cx: 850}, time, generateCircles2());
circle.animate(cirAni.delay(100));
}
如何让每 100 毫秒而不是一次生成一个圆圈?谢谢
【问题讨论】:
-
如果你可以在JSFiddle中组织可重现的例子,我可以看看。
-
我运行它时没有任何反应。请添加 HTML/CSS。
-
抱歉,这里完全是初学者,以前从未使用过 jsfiddle,不知道如何运行它
-
您可以将您的 HTML/CSS 添加到帖子中吗?
标签: javascript animation raphael