if (document.all) {
yourlogo = "欢迎您的光临";
logofont = "宋体";
logocolor = "000000";
yourlogo = yourlogo.split('');
l = yourlogo.length;
trigsplit = 360 / l;
sz = new array()
logowidth = 100;
logoheight = -30;
ypos = 0;
xpos = 0;
step = 0.03;
currstep = 0;
document.write('');
for (i = 0; i < l; i++) {
document.write(''+yourlogo[i]+'');
}
document.write('');
function mouse() {
ypos = event.y;
xpos = event.x - 5;
}
document.onmousemove=mouse;
function animatelogo() {
outer.style.pixeltop = document.body.scrolltop;
for (i = 0; i < l; i++) {
ie[i].style.top = ypos + logoheight * math.sin(currstep + i * trigsplit * math.pi / 180);
ie[i].style.left = xpos + logowidth * math.cos(currstep + i * trigsplit * math.pi / 180);
sz[i] = ie[i].style.pixeltop - ypos;
if (sz[i] < 5) sz[i] = 5;
ie[i].style.fontsize = sz[i] / 1.7;
}
currstep -= step;
settimeout('animatelogo()', 20);
}
window.onload = animatelogo;
}
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]
这是一段跟随鼠标旋转的文字,我希望字体在旋转的时候,每一个字的颜色都互不相同。不知道应该如何实现呢?
if (document.all) {
yourlogo = "七度空间欢迎您的光临";
logofont = "宋体";
logocolor = ["f0f8ff","faebd7","00ffff","7fffd4","f0ffff","f5f5dc","ffe4c4","000000","ffebcd","0000ff","8a2be2","a52a2a","deb887","5f9ea0","7fff00","d2691e","ff7f50","6495ed","fff8dc","dc143c","00ffff","00008b","008b8b","b8860b","a9a9a9","006400","bdb76b","8b008b","556b2f","ff8c00","9932cc","8b0000","e9967a","8fbc8b","483d8b","2f4f4f","00ced1","9400d3","ff1493","00bfff","696969","1e90ff","b22222","fffaf0","228b22","ff00ff","dcdcdc","f8f8ff","ffd700","daa520","808080","008000","adff2f","f0fff0","ff69b4","cd5c5c","4b0082","fffff0","f0e68c","e6e6fa","fff0f5","7cfc00","fffacd","add8e6","f08080","e0ffff","fafad2","90ee90","d3d3d3","ffb6c1","ffa07a","20b2aa","87cefa","778899","b0c4de","ffffe0","00ff00","32cd32","faf0e6","ff00ff","800000","66cdaa","0000cd","ba55d3","9370db","3cb371","7b68ee","00fa9a","48d1cc","c71585","191970","f5fffa","ffe4e1","ffe4b5","ffdead","000080","fdf5e6","808000","6b8e23","ffa500","ff4500","da70d6","eee8aa","98fb98","afeeee","db7093","ffefd5","ffdab9","cd853f","ffc0cb","dda0dd","b0e0e6","800080","ff0000","bc8f8f","4169e1","8b4513","fa8072","f4a460","2e8b57","fff5ee","a0522d","c0c0c0","87ceeb","6a5acd","708090","fffafa","00ff7f","4682b4","d2b48c","008080","d8bfd8","ff6347","40e0d0","ee82ee","f5deb3","f5f5f5","ffff00","9acd32"];
yourlogo = yourlogo.split('');
l = yourlogo.length;
trigsplit = 360 / l;
sz = new array()
logowidth = 100;
logoheight = -30;
ypos = 0;
xpos = 0;
step = 0.03;
currstep = 0;
document.write('');
for (i = 0; i < l; i++) {
document.write(''+yourlogo[i]+'');
}
document.write('');
function mouse() {
ypos = event.y;
xpos = event.x - 5;
}
document.onmousemove=mouse;
function animatelogo() {
outer.style.pixeltop = document.body.scrolltop;
for (i = 0; i < l; i++) {
ie[i].style.top = ypos + logoheight * math.sin(currstep + i * trigsplit * math.pi / 180);
ie[i].style.left = xpos + logowidth * math.cos(currstep + i * trigsplit * math.pi / 180);
sz[i] = ie[i].style.pixeltop - ypos;
if (sz[i] < 5) sz[i] = 5;
ie[i].style.fontsize = sz[i] / 1.7;
}
currstep -= step;
settimeout('animatelogo()', 20);
}
window.onload = animatelogo;
}
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]