我正在尝试制作 100 个动画,每个动画都有不同的延迟。出了点问题,因为每个人都没有收到他特定的动画。这是代码:
var text = $("#cont").text();
var count = 1;
var before = 0;
var after = 0;
var counter = "";
for (var i = 1; i <= 20; i++) {
for (var j = 1; j <= 5; j++) {
counter = before + "." + after;
after += 2;
text += "<div class='ball' id='ball" + count + "'></div><br />";
$("#ball" + count).css({
"-webkit-animation": "ball 3.5s linear" + counter + "s infinite normal",
"-moz-animation": "ball 3.5s linear" + counter + "s infinite normal",
"-ms-animation": "ball 3.5s linear" + counter + "s infinite normal",
"-o-animation": "ball 3.5s linear" + counter + "s infinite normal",
"animation": "ball 3.5s linear" + counter + "s infinite normal",
});
count++;
}
after = 0;
before++;
}
i--;
$("#cont").html(text);