跟随鼠标飘动的文字。光线渐变

跟随鼠标飘动文字及光线渐变效果实现
跟随鼠标飘动的文字。光线渐变。<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <!-- /*******************************Copyleft****************************************** Arkys Web Builder Toys :: Dreamweaver3 :: Flying fonts follow your mouse Coder by Arky; data:2000-1-21; mailto:arky@21cn.com; icq:17119978 for more tools, please visit http://cnlingo.yeah.net *********************************************************************************/ //define message content var message = "Loading......",bgcolor="99ccff"; message=message.split(""); var times=message.length; //predefine preferences var x,y,xspace,yspace,speed,colorv="EEEEEE"; var xpos=new Array(),ypos=new Array(); for (i=0;i<=times-1;i++)xpos[i]=-50; for (i=0;i<=times.length-1;i++)ypos[i]=-50; //predefine switchs var flag=false,Pcolorstyle=3,runflag=true; //predefine colorgraind var cyclecolor=new Array(times),runcolor=new Array(times); var keycolor=0,randkey=-1,basestep=0,keycstate=true; function preset(xval,yval,spval,xreval,yreval){ xspace=xval*xreval;yspace=yval*yreval;speed=spval; bgcolor=(document.bgColor.length == 7)?document.bgColor.substring(1,7):"ffffff"; makecolor(); } function makecolor(){//make a color cycle if (Pcolorstyle > 0){ hexa = new Array(16); for(var i = 0; i < 10; i++)hexa[i] = i;hexa[10]="a"; hexa[11]="b"; hexa[12]="c";hexa[13]="d"; hexa[14]="e"; hexa[15]="f"; var alycolor=new Array(parseInt("0x"+colorv.substring(0,2)),parseInt("0x"+colorv.substring(2,4)),parseInt("0x"+colorv.substring(4,6))); var alybgcolor=new Array(parseInt("0x"+bgcolor.substring(0,2)),parseInt("0x"+bgcolor.substring(2,4)),parseInt("0x"+bgcolor.substring(4,6))); var colordelta=new Array((alycolor[0]-alybgcolor[0])/times,(alycolor[1]-alybgcolor[1])/times,(alycolor[2]-alybgcolor[2])/times); for(i=0;i<times;i++){ var rgb1=alycolor[0]-colordelta[0]*i; var rgb2=alycolor[1]-colordelta[1]*i; var rgb3=alycolor[2]-colordelta[2]*i; cyclecolor[i]="#"+hexa[Math.floor(rgb1/16)] + hexa[Math.floor(rgb1%16)]+hexa[Math.floor(rgb2/16)] + hexa[Math.floor(rgb2%16)]+hexa[Math.floor(rgb3/16)] + hexa[Math.floor(rgb3%16)]; } }else for(i=0;i<times;i++)cyclecolor[i]="#"+colorv; } makecolor(); for (i=0;i<times;i++){ var towrit = "<span id=\"span"+i+"\" style=\" FONT-WEIGHT: bold; FONT-SIZE: 12pt; VISIBILITY: visible; COLOR:"+cyclecolor[i]+"; font-family:mono; POSITION: absolute; TOP: -50px \" >"; document.write(towrit); document.write(message[i]); document.write("</span>"); } if (document.layers)document.captureEvents(Event.MOUSEMOVE); document.onmousemove = handlerMM; function AKmakesnake() { //make fly snake if (Pcolorstyle >2){ //exchange color for(i=0;i<times;i++)if(keycolor-i>-1)runcolor[keycolor-i]=(keycstate)?cyclecolor[i]:cyclecolor[times-i-1]; for(i=0;i<times;i++)if(keycolor+i<times)runcolor[keycolor+i]=(keycstate)?cyclecolor[i]:cyclecolor[times-i-1]; if(keycolor == times){ keycolor=0; keycstate=(keycstate)?false:true; }else keycolor++; } if(flag){ for (i=times-1; i>=1; i--) { xpos[i]=xpos[i-1]+Math.abs(xspace); ypos[i]=ypos[i-1]; } if (runflag){ xpos[0]=x+xspace+basestep*2; ypos[0]=y+yspace+basestep*2; basestep += randkey; if (Math.abs(basestep)>times/3)randkey=(randkey==1)?-1:1; }else{ xpos[0]=x+xspace; ypos[0]=y+yspace; } for (i=0; i<times; i++) { var layerleft=(document.all)?eval("span"+(i)+".style.posLeft=xpos[i]"):("document.span"+i+".left=xpos[i]"); var layertop=(document.all)?eval("span"+(i)+".style.posTop=ypos[i]"):("document.span"+i+".top=ypos[i]"); if (Pcolorstyle >2)(document.all)?eval("span"+(i)+".style.color=runcolor[i]"):("document.span"+i+".color=runcolor[i]"); } } var timer=setTimeout("AKmakesnake()",speed) } function handlerMM(e){ x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX; y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY; flag=true; } //-->
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值