Ich habe diesen Code, aber die Verzögerung auf die Animationen ist nur vom Anfang der Animation, und die Generierung von Kreisen ist nicht ausgebreitet, da sie alle auf einmal erscheinen.JavaScript Raphael mit Verzögerung
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));
}
Wie bekomme ich die Kreise alle 100ms und nicht alle gleichzeitig? Danke
Wenn Sie reproduzierbare Beispiel in JSFiddle organisieren können, kann ich einen Blick darauf werfen. –
https://jsfiddle.net/3yd8bde/8/ –
Nichts passiert, wenn ich es betreibe. Bitte fügen Sie HTML/CSS hinzu. –