藍天駿
|
分享:
▼
x0
|
[HTML][討論] 滑鼠特效
滑鼠軌跡: <!--軌跡游標_開始--> <STYLE type=text/css> <!-- BODY { OVERFLOW-X: hidden; OVERFLOW: scroll } --> </STYLE> <SCRIPT language=JavaScript> <!-- <!--在此修改軌跡的長度--> var trailLength = 15; var path = "圖檔連結網址"; var isIE = false, isNav = false, range = "all.", style = ".style", i, d = 0; var topPix = ".pixelTop", leftPix = ".pixelLeft", images, storage; if (document.layers) { isNav = true, range = "layers.", style = "", topPix = ".top", leftPix = ".left"; } else if (document.all) { isIE = true; } function initTrail() { images = new Array(); for (i = 0; i < parseInt(trailLength); i++) { images = new Image(); images.src = path; } storage = new Array(); for (i = 0; i < images.length*3; i++) { storage = 0; } for (i = 0; i < images.length; i++) { // make divs for IE and layers for Navigator (isIE) ? document.write('<div id="obj' + i + '" style="position: absolute; z-Index: 100; height: 0; width: 0"><img src="' + images.src + '"></div>') : document.write('<layer name="obj' + i + '" width="0" height="0" z-index="100"><img src="' + images.src + '"></layer>'); } trail(); } function trail() { for (i = 0; i < images.length; i++) { eval("document." + range + "obj" + i + style + topPix + "=" + storage[d]); eval("document." + range + "obj" + i + style + leftPix + "=" + storage[d+1]); d = d+2; } for (i = storage.length; i >= 2; i--) {; storage = storage[i-2]; } d = 0; clearTimeout(timer); var timer = setTimeout("trail()", 10); } function processEvent(e) { if (isIE) { storage[0] = window.event.y+document.body.scrollTop+10; storage[1] = window.event.x+document.body.scrollLeft+10; } else { storage[0] = e.pageY+12; storage[1] = e.pageX+12; } } if (isNav) { document.captureEvents(Event.MOUSEMOVE); } if (isIE || isNav) { initTrail(); document.onmousemove = processEvent; } --> </SCRIPT> <!--軌跡游標_結束-->
滑鼠時鐘: <!--滑鼠時鐘_開始--> <!--語法在網頁插入的開始--> <script language="JavaScript"> <!-- <!--在此修改時鐘外圈的顏色--> dCol=ƆF4E57' <!--在此修改時鐘內圈的顏色--> fCol='CC0000' <!--在此修改秒針顏色--> sCol=' <!--在此修改分針顏色--> mCol=྅AAB5' <!--在此修改時針顏色--> hCol=' ClockHeight=40; ClockWidth=40; ClockFromMouseY=0; ClockFromMouseX=100; d=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); m=new Array("現在是一月","現在是二月","現在是三月","現在是四月","現在是五月","現在是六月","現在是七月","現在是八月","現在是九月","現在是十月","現在十一月","現在十二月"); date=new Date(); day=date.getDate(); year=date.getYear(); if (year < 2000) year=year+1900; TodaysDate="年 "+d[date.getDay()]+" "+day+"日 "+m[date.getMonth()]+" "+year; D=TodaysDate.split(''); H='...' H=H.split(''); M='....' M=M.split(''); S='.....' S=S.split(''); Face=Ƈ 2 3 4 5 6 7 8 9 10 11 12' font='Arial' size=1; speed=0.6; ns=(document.layers); ie=(document.all); Face=Face.split(' '); n=Face.length; a=size*10; ymouse=0; xmouse=0; scrll=0; props="<font face="+font+" size="+size+" color="+fCol+">"; props2="<font face="+font+" size="+size+" color="+dCol+">"; Split=360/n; Dsplit=360/D.length; HandHeight=ClockHeight/4.5 HandWidth=ClockWidth/4.5 HandY=-7; HandX=-2.5; scrll=0; step=0.06; currStep=0; y=new Array();x=new Array();Y=new Array();X=new Array(); for (i=0; i < n; i++){y=0;x=0;Y=0;X=0} Dy=new Array();Dx=new Array();DY=new Array();DX=new Array(); for (i=0; i < D.length; i++){Dy=0;Dx=0;DY=0;DX=0} if (ns){ for (i=0; i < D.length; i++) document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D+'</font></center></layer>'); for (i=0; i < n; i++) document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face+'</font></center></layer>'); for (i=0; i < S.length; i++) document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S+'</b></center></font></layer>'); for (i=0; i < M.length; i++) document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M+'</b></center></font></layer>'); for (i=0; i < H.length; i++) document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H+'</b></center></font></layer>'); } if (ie){ document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < D.length; i++) document.write('<div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+'width:'+a+'text-align:center">'+props2+D+'</font></div>'); document.write('</div></div>'); document.write('<div id="Of" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < n; i++) document.write('<div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+'width:'+a+'text-align:center">'+props+Face+'</font></div>'); document.write('</div></div>'); document.write('<div id="Oh" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < H.length; i++) document.write('<div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+'text-align:center;font-weight:bold">'+H+'</div>'); document.write('</div></div>'); document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < M.length; i++) document.write('<div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+'text-align:center;font-weight:bold">'+M+'</div>'); document.write('</div></div>') document.write('<div id="Os" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < S.length; i++) document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+'text-align:center;font-weight:bold">'+S+'</div>'); document.write('</div></div>') } (ns)?window.captureEvents(Event.MOUSEMOVE):0; function Mouse(evnt){ ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY; xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX; } (ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse; function ClockAndAssign(){ time = new Date (); secs = time.getSeconds(); sec = -1.57 + Math.PI * secs/30; mins = time.getMinutes(); min = -1.57 + Math.PI * mins/30; hr = time.getHours(); hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360; if (ie){ Od.style.top=window.document.body.scrollTop; Of.style.top=window.document.body.scrollTop; Oh.style.top=window.document.body.scrollTop; Om.style.top=window.document.body.scrollTop; Os.style.top=window.document.body.scrollTop; } for (i=0; i < n; i++){ var F=(ns)?document.layers['nsFace'+i]:ieFace.style; F.top=y + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll; F.left=x + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180); } for (i=0; i < H.length; i++){ var HL=(ns)?document.layers['nsHours'+i]:ieHours.style; HL.top=y+HandY+(i*HandHeight)*Math.sin(hrs)+scrll; HL.left=x+HandX+(i*HandWidth)*Math.cos(hrs); } for (i=0; i < M.length; i++){ var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes.style; ML.top=y+HandY+(i*HandHeight)*Math.sin(min)+scrll; ML.left=x+HandX+(i*HandWidth)*Math.cos(min); } for (i=0; i < S.length; i++){ var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds.style; SL.top=y+HandY+(i*HandHeight)*Math.sin(sec)+scrll; SL.left=x+HandX+(i*HandWidth)*Math.cos(sec); } for (i=0; i < D.length; i++){ var DL=(ns)?document.layers['nsDate'+i]:ieDate.style; DL.top=Dy + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll; DL.left=Dx + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180); } currStep-=step; } function Delay(){ scrll=(ns)?window.pageYOffset:0; Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed); Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed); for (i=1; i < D.length; i++){ Dy=Math.round(DY+=(Dy[i-1]-DY)*speed); Dx=Math.round(DX+=(Dx[i-1]-DX)*speed); } y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed); x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed); for (i=1; i < n; i++){ y=Math.round(Y+=(y[i-1]-Y)*speed); x=Math.round(X+=(x[i-1]-X)*speed); } ClockAndAssign(); setTimeout('Delay()',20); } if (ns||ie)window.onload=Delay; --> </script> <!--滑鼠時鐘_結束-->
滑鼠螢火蟲: <!--滑鼠螢火蟲_開始--> <LAYER NAME="a0" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a1" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a2" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a3" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a4" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a5" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a6" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a7" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a8" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a9" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a10" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a11" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a12" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a13" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a14" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a15" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a16" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a17" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a18" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a19" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a20" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a21" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a22" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a23" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a24" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a25" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a26" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a27" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a28" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a29" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a30" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a31" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a32" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a33" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a34" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a35" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a36" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a37" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a38" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a39" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a40" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a41" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a42" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a43" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a44" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a45" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <LAYER NAME="a46" LEFT=10 TOP=10 VISIBILITY=SHOW BGCOLOR="#FFFF80" CLIP="0,0,3,3"></LAYER> <script language="JavaScript"> <!-- if (document.all){ document.write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">') for (xy=0;xy<47;xy++) document.write('<div style="position:relative;width:3px;height:3px;background:#FFFF80;font-size:2px;visibility:visible"></div>') document.write('</div>') } if (document.layers) {window.captureEvents(Event.MOUSEMOVE);} var yBase = 200; var xBase = 200; var yAmpl = 10; var yMax = 40; var step = .2; var ystep = .5; var currStep = 0; var tAmpl=1; var Xpos = 1; var Ypos = 1; var I = 0; var j = 0; if (document.all) { function MoveHandler(){ Xpos = document.body.scrollLeft+event.x; Ypos = document.body.scrollTop+event.y; } document.onmousemove = MoveHandler; } else if (document.layers) { function xMoveHandler(evnt){ Xpos = evnt.pageX; Ypos = evnt.pageY; } window.onMouseMove = xMoveHandler; } function animateLogo() { if (document.all) { yBase = window.document.body.offsetHeight/4; xBase = window.document.body.offsetWidth/4; } else if (document.layers) { yBase = window.innerHeight/4 ; xBase = window.innerWidth/4; } if (document.all) { var totaldivs=document.all.starsDiv.all.length for ( I = 0 ; I < totaldivs ; I++ ) { var tempdiv=document.all.starsDiv.all[I].style tempdiv.top = Ypos + Math.cos((20*Math.sin(currStep/20))+I*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + I*25)/10); tempdiv.left = Xpos + Math.sin((20*Math.sin(currStep/20))+I*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + I*25)/10); }} else if (document.layers) { for ( j = 0 ; j < 47 ; j++ ) { var templayer="a"+j document.layers[templayer].top = Ypos + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10); document.layers[templayer].left =Xpos + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10); }} currStep += step; setTimeout("animateLogo()", 15); } animateLogo(); --> </script> <!--滑鼠螢火蟲_結束-->
|