我是一只历经沧桑的老狮

跟随鼠标旋转的圆环/文字

直接上方法吧。放在页脚 footer.php</body>之前就可以了。

旋转的圆环

<script language="JavaScript">
<!-- 
//Pick your own colours below!!
CoLoUrS=new Array('00ff00','ff00ff','fff000','3366ff');
var step=0.3,a_StEp=0.05,RunTime=0,currStep=0,Xpos=0,Ypos=0,cntr=70,count_a=0;
var count=0,move=1,Ay=0,Ax=0,dots=16;var x;brwsr=(document.layers)?1:0;
if (brwsr){for (i=0; i < dots; i++){document.write('<LAYER NAME="a'+i+'" LEFT=0 TOP=0 BGCOLOR=#3366ff CLIP="0,0,3,3"></LAYER>');
}
window.captureEvents(Event.MOUSEMOVE);
function nsMouse(evnt){
 Xpos = evnt.pageX;
 Ypos = evnt.pageY;
 }
window.onMouseMove = nsMouse
}
else{document.write('<div id="ys" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < dots; i++){document.write('<div id="ieDivs" style="position:absolute;top:0px;left:0px;width:3px;height:3px;background:#3366ff;font-size:3px"></div>');
}
document.write('</div></div>');
function ieMouse(){
 Ypos=event.y;
 Xpos=event.x;
 }
window.document.onmousemove = ieMouse
}

function MouseFollow(){ay = Math.round(Ay+=(Ypos- Ay)* 4/40);
ax = Math.round(Ax+=(Xpos- Ax)* 4/40);
setTimeout('MouseFollow()',10);
}
function colourStep(){
count+=move;
if (count >= dots) {count=0;count_a+=move}
if (count_a == CoLoUrS.length) count_a=0;
if (brwsr) document.layers["a"+count].bgColor=CoLoUrS[count_a];
else ieDivs[count].style.background=CoLoUrS[count_a];
setTimeout('colourStep()',100)
}
function TwistnSpin(){if (!brwsr) ys.style.top=document.body.scrollTop;
for (i=0; i < dots; i++) 
 {var allLayers=(document.layers)?document.layers["a"+i]:ieDivs[i].style;
 allLayers.top=ay+cntr*Math.cos((currStep+i*4)/10.2)*Math.sin(currStep/20);
 allLayers.left=ax+cntr*Math.sin((currStep+i*4)/10.2)*Math.cos(1+currStep/20);
 }
currStep-=step;
setTimeout("TwistnSpin()",10);
}
function CombineNstart(){MouseFollow();TwistnSpin();colourStep();
}
window.onload=CombineNstart;
// End Pretty -->
</script>

旋转的文字

<script language="JavaScript">
<!--
var mouse=new Object()
mouse.msg=" 欢迎光临站岩豚鼠 "
mouse.x=0
mouse.y=0
mouse.speed=Math.PI/180  // 1 degree
mouse.radius=50
mouse.ms=new Array()
if(document.layers){document.captureEvents(Event.MOUSEMOVE)
 for(i=0;i<=mouse.msg.length;i++)document.write("<layer name='mousetext"+i+"'>"+mouse.msg.charAt(i)+"</layer>")
}else
 for(i=0;i<=mouse.msg.length;i++)document.write("<span id='mousetext"+i+"' class='tacoscript'>"+mouse.msg.charAt(i)+"</span>")
for(i=0;i<=mouse.msg.length;i++){mouse.ms[i]=document.getElementById?document.getElementById("mousetext"+i).style:document.all?document.all["mousetext"+i].style:document.layers["mousetext"+i]
 mouse.ms[i].deg=Math.PI*2/mouse.msg.length*i}
document.onmousemove=function m(e){if(!e)e=event
 mouse.x=document.all?document.body.scrollLeft+e.clientX:e.pageX
 mouse.y=document.all?document.body.scrollTop+e.clientY:e.pageY
 run()}
function run(){for(i=mouse.ms.length-1;i>=0;i--){mouse.ms[i].deg+=mouse.speed
  mouse.ms[i].left=mouse.x-Math.sin(mouse.ms[i].deg)*mouse.radius
  mouse.ms[i].top=mouse.y+Math.cos(mouse.ms[i].deg)*mouse.radius}}
setInterval(run,100)
//-->
</script>
本站未注明转载的文章均为原创,转载请注明来源,谢谢!

添加新评论