返回首页
当前位置: 主页 > 网络编程 > Jsp实例教程 >

JS特效围绕鼠标的立体旋转文字代码

时间:2011-05-15 19:41来源:知行网www.zhixing123.cn 编辑:麦田守望者

<html>
<head>
<title>网页特效|zhixing123.cn|---围绕鼠标的立体旋转文字</title>
<meta content="text/html; charset=gb2312" http-equiv="Content-Type">
class="innerlink">FrontPage</a> 5.0" name="GENERATOR">
</head>
<body>
<script LANGUAGE="JavaScript">
<!-- Begin
if (document.all) {
yourLogo = "很简单哦 谁都看得懂"; //Not less than 2 letters!
logoFont = "Arial";
logoColor = "ff0000";
//Nothing needs altering below!
yourLogo = yourLogo.split('');
L = yourLogo.length;
TrigSplit = 360 / L;
Sz = new Array()
logoWidth = 100;
logoHeight = -30;
ypos = 0;
xpos = 0;
step = 0.09;
currStep = 0;
document.write('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < L; i++) {
document.write('<div id="ie" style="position:absolute;top:0px;left:0px;'
+'width:10px;height:10px;font-family:'+logoFont+';font-size:12px;'
+'color:'+logoColor+';text-align:center">'+yourLogo[i]+'</div>');
}
document.write('</div></div>');
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;
}
// End -->
</script>
</body>
</html>
 

------分隔线----------------------------
标签(Tag):Javascript javascript实例教程 javascript特效 javascript代码
------分隔线----------------------------
推荐内容
猜你感兴趣