介绍:360度旋转的鼠标跟随文字。
演示:
[Ctrl+A全选 提示:你可先修改部分代码,再按运行]
下面教你如何应用此特效:
--------------------------------------------------------------------------------------
需要在<body
这里>加入的代码:
--------------------------------------------------------------------------------------
以下代码加到<head>…</head>中
以下代码加到<body>…</body>中
<SCRIPT LANGUAGE="JavaScript">
if (document.all) {
yourplmm = "站长手册特效代码";
plmmFont = "宋体";
plmmColor = "green";
plmmWeight = "bold";
yourplmm = yourplmm.split('');
L = yourplmm.length;
TrigSplit = 360 / L;
Sz = new Array()
plmmWidth = 100;
plmmHeight = -30;
ypos = 0;
xpos = 0;
step = 0.03;
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:'+plmmFont+';font-size:12px;'
+'color:'+plmmColor+';font-weight:'+plmmWeight+';text-align:center">'+yourplmm[I]+'</div>');
}
document.write('</div></div>');
function Mouse() {
ypos = event.y;
xpos = event.x - 5;
}
document.onmousemove=Mouse;
function animateplmm() {
outer.style.pixelTop = document.body.scrollTop;
for (I = 0; I < L; I++) {
ie[I].style.top = ypos + plmmHeight * Math.sin(currStep + I * TrigSplit * Math.PI / 180);
ie[I].style.left = xpos + plmmWidth * 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('animateplmm()', 20);
}
window.onload = animateplmm;
}
</script>