http://topic.csdn.net/u/20091224/14/f6ece1d1-ad06-4d41-83b7-bce1a95d7aaf.html?94991
<html>
<head><title>zswang有中文又如何</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<style>
body{overflow:hidden;background-color:Black;}
</style>
<body>
<script text="text/javascript">
function hsl2color(hsl) {//另存为utf-8 就好了
if (hsl.h > 360 || hsl.h < 0 || hsl.s > 100 || hsl.s < 0 || hsl.l > 100 || hsl.l < 0)
return "#000000";
var rgb = {r: 0, g: 0, b: 0};
if (hsl.h <= 60) {
rgb.r = 255;
rgb.g = 255 / 60 * hsl.h;
} else if (hsl.h <= 120) {
rgb.r = 255 - (255 / 60) * (hsl.h - 60);//我爱u
rgb.g = 255;
} else if (hsl.h <= 180) {
rgb.g = 255;
rgb.b = (255 / 60) * (hsl.h - 120);
} else if (hsl.h <= 240) {
rgb.g = 255 - (255 / 60) * (hsl.h - 180);
rgb.b = 255;
} else if (hsl.h <= 300) {
rgb.r = (255 / 60) * (hsl.h - 240);
rgb.b = 255;
} else if (hsl.h <= 360) {
rgb.r = 255;
rgb.b = 255 - (255 / 60) * (hsl.h - 300);
}
var sat = Math.abs((hsl.s - 100) / 100);
rgb.r = rgb.r - (rgb.r - 128) * sat;
rgb.g = rgb.g - (rgb.g - 128) * sat;
rgb.b = rgb.b - (rgb.b - 128) * sat;
var lum = (hsl.l - 50) / 50;
if (lum > 0) {
rgb.r = rgb.r + (255 - rgb.r) * lum;
rgb.g = rgb.g + (255 - rgb.g) * lum;
rgb.b = rgb.b + (255 - rgb.b) * lum;
} else if (lum < 0) {
rgb.r = rgb.r + rgb.r * lum;
rgb.g = rgb.g + rgb.g * lum;
rgb.b = rgb.b + rgb.b * lum;
}
return "#" + ("00000" + (Math.floor(rgb.r) * 256 * 256 +
Math.floor(rgb.g) * 256 + Math.floor(rgb.b)
).toString(16)).replace(/^.*(.{6}$)/g, "$1");
}//
function Neon(options) {
options = options || {};
this.interval = options.interval || 500; //
this.parent = options.parent || document.body; //
this.bulbCount = options.bulbCount || 100;
this.bulbs = {};
var h = document.body.clientHeight || document.documentElement.clientHeight;
var w = document.body.clientWidth || document.documentElement.clientWidth;
for (var i = 0; i < this.bulbCount; i++) {
this.bulbs[i] = new Bulb({
size: 10 + Math.random() * 10,
pos: {x: Math.random() * w, y: Math.random() * h},
hue: Math.random() * 360,
lightness: Math.random() * 100
});
}
}Neon.prototype = {
replay: function() {
var self = this;
setInterval(function() { self.tick(); }, this.interval);
},
tick: function() {
for (var i = 0; i < this.bulbCount; i++) {
this.bulbs[i].lightness = (this.bulbs[i].lightness + 2) % 100;
this.bulbs[i].doChange();
}
}
}// 灯泡
function Bulb(options) {
options = options || {};
this.parent = options.parent || document.body; //
this.shape = options.shape || "●"; //
this.size = options.size || 12; //
this.pos = options.pos || {}; //
this.hue = options.hue || 100; //
this.saturation = options.saturation || 100; //
this.lightness = options.lightness || 50; // this.span = document.createElement("span");
this.parent.appendChild(this.span);
this.span.style.position = "absolute";
this.span.style.fontSize = this.size + "px";
this.span.style.left = this.pos.x + "px";
this.span.style.top = this.pos.y + "px";
this.span.innerHTML = this.shape;
this.doChange();
}Bulb.prototype = {
doChange: function() {
this.span.style.color = hsl2color(
{h: this.hue, s: this.saturation, l: this.lightness}
);
}
}new Neon().replay();
</script>
</body>
</html>
<html>
<head><title>zswang有中文又如何</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<style>
body{overflow:hidden;background-color:Black;}
</style>
<body>
<script text="text/javascript">
function hsl2color(hsl) {//另存为utf-8 就好了
if (hsl.h > 360 || hsl.h < 0 || hsl.s > 100 || hsl.s < 0 || hsl.l > 100 || hsl.l < 0)
return "#000000";
var rgb = {r: 0, g: 0, b: 0};
if (hsl.h <= 60) {
rgb.r = 255;
rgb.g = 255 / 60 * hsl.h;
} else if (hsl.h <= 120) {
rgb.r = 255 - (255 / 60) * (hsl.h - 60);//我爱u
rgb.g = 255;
} else if (hsl.h <= 180) {
rgb.g = 255;
rgb.b = (255 / 60) * (hsl.h - 120);
} else if (hsl.h <= 240) {
rgb.g = 255 - (255 / 60) * (hsl.h - 180);
rgb.b = 255;
} else if (hsl.h <= 300) {
rgb.r = (255 / 60) * (hsl.h - 240);
rgb.b = 255;
} else if (hsl.h <= 360) {
rgb.r = 255;
rgb.b = 255 - (255 / 60) * (hsl.h - 300);
}
var sat = Math.abs((hsl.s - 100) / 100);
rgb.r = rgb.r - (rgb.r - 128) * sat;
rgb.g = rgb.g - (rgb.g - 128) * sat;
rgb.b = rgb.b - (rgb.b - 128) * sat;
var lum = (hsl.l - 50) / 50;
if (lum > 0) {
rgb.r = rgb.r + (255 - rgb.r) * lum;
rgb.g = rgb.g + (255 - rgb.g) * lum;
rgb.b = rgb.b + (255 - rgb.b) * lum;
} else if (lum < 0) {
rgb.r = rgb.r + rgb.r * lum;
rgb.g = rgb.g + rgb.g * lum;
rgb.b = rgb.b + rgb.b * lum;
}
return "#" + ("00000" + (Math.floor(rgb.r) * 256 * 256 +
Math.floor(rgb.g) * 256 + Math.floor(rgb.b)
).toString(16)).replace(/^.*(.{6}$)/g, "$1");
}//
function Neon(options) {
options = options || {};
this.interval = options.interval || 500; //
this.parent = options.parent || document.body; //
this.bulbCount = options.bulbCount || 100;
this.bulbs = {};
var h = document.body.clientHeight || document.documentElement.clientHeight;
var w = document.body.clientWidth || document.documentElement.clientWidth;
for (var i = 0; i < this.bulbCount; i++) {
this.bulbs[i] = new Bulb({
size: 10 + Math.random() * 10,
pos: {x: Math.random() * w, y: Math.random() * h},
hue: Math.random() * 360,
lightness: Math.random() * 100
});
}
}Neon.prototype = {
replay: function() {
var self = this;
setInterval(function() { self.tick(); }, this.interval);
},
tick: function() {
for (var i = 0; i < this.bulbCount; i++) {
this.bulbs[i].lightness = (this.bulbs[i].lightness + 2) % 100;
this.bulbs[i].doChange();
}
}
}// 灯泡
function Bulb(options) {
options = options || {};
this.parent = options.parent || document.body; //
this.shape = options.shape || "●"; //
this.size = options.size || 12; //
this.pos = options.pos || {}; //
this.hue = options.hue || 100; //
this.saturation = options.saturation || 100; //
this.lightness = options.lightness || 50; // this.span = document.createElement("span");
this.parent.appendChild(this.span);
this.span.style.position = "absolute";
this.span.style.fontSize = this.size + "px";
this.span.style.left = this.pos.x + "px";
this.span.style.top = this.pos.y + "px";
this.span.innerHTML = this.shape;
this.doChange();
}Bulb.prototype = {
doChange: function() {
this.span.style.color = hsl2color(
{h: this.hue, s: this.saturation, l: this.lightness}
);
}
}new Neon().replay();
</script>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货