如果有人知道cssanimation.io,我有一点问题.. 我该如何设置动画延迟?我把它放在任何地方,但动画总是在我重新加载页面而不是在5s之后开始
答案 0 :(得分:0)
您可以设置animationdelay delay = 5000;
将以下代码中的延迟从100
(默认)更改为5000
(5s)
window.onload = function () {
splitText()
};
function splitText() {
var a = document.getElementsByClassName('cssanimation');
for (var i = 0; i < a.length; i++) {
var $this = a[i];
var letter = $this.innerHTML;
letter = letter.trim();
var str = '';
var delay = 5000;
for (l = 0; l < letter.length; l++) {
if (letter[l] != ' ') {
str += '<span style="animation-delay:' + delay + 'ms; -moz-animation-delay:' + delay + 'ms; -webkit-animation-delay:' + delay + 'ms; ">' + letter[l] + '</span>';
delay += 150;
}
else
str += letter[l];
}
$this.innerHTML = str;
}
}