所以,我知道如何制作一个单一的文字闪光颜色。这是一个例子:
// List of colors
var spectrum = ['#f00', '#f66', '#969', '#00F', '#0FB53F'];
var cycle = spectrum.length - 1;
// Cycle speed
var speed = 50;
var i = 0;
window.setInterval(function () {
document.getElementById("WL").style.color = spectrum[i];
if (i < cycle) i++;
else i = 0;
}, speed);
但是,我该如何制作那个容器或整个身体的闪光颜色?提前谢谢。
答案 0 :(得分:0)
解决:
http://jsfiddle.net/kffho8ra/1/
var spectrum = ['#f00', '#f66', '#969', '#00F', '#0FB53F'];
var cycle = spectrum.length - 1;
var speed = 50;
var i = 0;
window.setInterval(function () {
document.body.style.backgroundColor = spectrum[i];
if (i < cycle) i++;
else i = 0;
}, speed);'