页面闪电效果
投稿 发布:2020-10-06 912

页面闪电效果
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>页面闪电效果 </title> </head> <BODY bgcolor="#ffffff" onload=window.focus();init(); onresize=document.location.href=document.location.href; onunload=halt();> <SCRIPT> <!-- ie4=document.all?1:0; ns4=document.layers?1:0; ns5=(document.getElementById && !document.all)?1:0; function init(){ // Bolt has an aura? (true | false) // takes twice as long to strike aura=false; bcolor="white"; acolor="blue"; // Make background color flash? (true | false) flash=true; skyNorm="black"; skyFlash="#000050"; if (flash) document.bgColor=skyNorm; // nbs = Number of main bolt segments nbs = 50; ct=0; // Font sizes for lightning bolt and aura segments fsb=shi*.3; fsf=shi*.2; fsbi=shi*.2; fsfi=shi*.12; fsbii=shi*.12; fsfii=shi*.07; xpos=cswi; ypos=0; if (ns5) ark = document.getElementById("ark"); if (ns4) { ol=document.layers["ark"]; ol = new Layer(swi); ol.left = 0; ol.top = 0; ol.height = shi; ol.zIndex=1; ol.visibility = "hide"; ret="<STYLE TYPE='text/css'>"; for (i=1;i<10;i++){ ret+="DIV.bolt"+i+" {position:absolute; font-style:'Times New Roman'; font-size:"+(fsf*i/9)+"px; color:"+bcolor+"; visibility:inherit; z-index:1}"; if (aura) ret+="DIV.bolta"+i+" {position:absolute; font-style:'Times New Roman'; font-size:"+(fsf*1.3*i/9)+"px; color:blue; visibility:inherit; z-index:0}"; } ret+="</STYLE>"; for (fs=1;fs<10;fs++) for (i=1;i<nbs;i++) { if (aura) ret+="<DIV id=a"+i+"f"+fs+""+fs+">.</DIV>"; ret+="<DIV id=s"+i+"f"+fs+""+fs+">.</DIV>"; } //ol.document.open(); ol.document.write(ret); ol.document.close(); } Time1=setTimeout("mainplot()",100); } function mainplot() { lang=0; xpos=Math.random()*cswi+cswi/2; ypos=0; fs=9; fsi=8 deg=Math.random()*30-15+((xpos<cswi)? +15:-15); jag=Math.round(Math.random()*100)/100; zag=Math.round(Math.random()*100)/100; cur=Math.round((.5 * (Math.random()*10-5))*100)/100; ion=(Math.random()>.5)? 1:-1; //status=" "+ct+" Divs "+format(jag)+" jag "+format(zag)+" zag "+cur+" curve"; ct=0; if (ns4) { for (i=1;i<nbs;i++) { ang=Math.random()*jag*90-jag*45; if (Math.random()+.05>zag).random()*zag*90-zag*45; ang+=lang; ct++; if (Math.random()*10>9.5 && fsi>1) {fsi--; leg1();} xpos+=Math.sin((deg+(ang+i*cur))/57.3)*(fsf*fs/9)*.07; ypos+=Math.abs(Math.cos((deg+(ang+i*cur))/57.3)*(fsf*fs/9)*.07); //fsb=fsf*1.5; if (aura) { ol.document.layers["a"+i+"f"+fs].moveTo(xpos-(fsf*1.3*fs/9)*.125,ypos-(fsf*1.3*fs/9)*.85); ct++;} ol.document.layers["s"+i+"f"+fs].moveTo(xpos-(fsf*fs/9)*.125,ypos-(fsf*fs/9)*.85); if (ypos>shi || xpos<0 || xpos>swi) i=nbs; } //status=" "+ct+" Divs "+format(jag)+" jag "+format(zag)+" zag "+cur+" curve"; ol.resizeTo(swi,shi); Time1=setTimeout("light()",100); } if (ie4 || ns5) { // Rewriting layers can be faster than repositioning in internet explorer ret=""; fsf=shi*.2; for (i=1;i<nbs;i++) { ang=Math.random()*jag*90-jag*45; if (Math.random()+.05>zag).random()*zag*90-zag*45; ang+=lang; ct++; if (Math.random()*10>9.5) {fsfi=fsf*.6; fsf*=.95; leg1();} xpos+=Math.sin((deg+(ang+i*cur))/57.3)*fsf*.07; ypos+=Math.abs(Math.cos((deg+(ang+i*cur))/57.3)*fsf*.07); fsb=fsf*1.3; if (ypos>shi || xpos<0 || xpos>swi) i=nbs; if (aura) { ret+="<DIV id='darg"+i+"' style='position:absolute; left:"+(xpos-fsb*.125)+"; top:"+(ypos-fsb*.85)+"; font-size:"+fsb+"px; color:rgb(0,0,255); z-Index:0' >.</DIV>"; ct++;} ret+="<DIV style='position:absolute; left:"+(xpos-fsf*.125)+"; top:"+(ypos-fsf*.85)+"; font-size:"+fsf+"px; color:"+bcolor+"; z-Index:1' >.</DIV>"; } //status=" "+ct+" Divs "+format(jag)+" jag "+format(zag)+" zag "+cur+" curve"; ark.innerHTML=ret; Time1=setTimeout("lightie()",100); } } function leg1() { xpo=xpos; ypo=ypos; lang=zag*ion*(30+Math.random()*20-10); ion*=-1; lang1=0; deg1=deg+ion*50+Math.random()*20-10; jlen=Math.random()*nbs*.25+nbs*.25; if(ns4) { fsii=fsi-1 for (j=1;j<jlen;j++) { ang1=Math.random()*jag*90-jag*45; if (Math.random()+.05>zag) lang1=Math.random()*zag*90-zag*45; ang1-=lang1; ct++; if (Math.random()*10>9.9 && fsii>1) {fsii--; leg2();} xpo+=Math.sin((deg1+(ang1+j*cur))/57.3)*(fsf*fsi/9)*.07; ypo+=Math.abs(Math.cos((deg1+(ang1+j*cur))/57.3)*(fsf*fsi/9)*.07); if (aura) { ol.document.layers["a"+j+"f"+fsi].moveTo(xpo-(fsf*1.3*fsi/9)*.125,ypo-(fsf*1.3*fsi/9)*.85); ct++;} ol.document.layers["s"+j+"f"+fsi].moveTo(xpo-(fsf*fsi/9)*.125,ypo-(fsf*fsi/9)*.85); if (ypo>shi || xpo<0 || xpo>swi) j=jlen; } } if (ie4 || ns5) { ret+="<DIV id='fork'>"; for (j=1;j<jlen;j++) { ang1=Math.random()*jag*90-jag*45; if (Math.random()+.05>zag) lang1=Math.random()*zag*90-zag*45; ang1-=lang1; ct++; if (Math.random()*10>9.9) {fsfii=fsfi*.6; fsfi*=.95; leg2();} xpo+=Math.sin((deg1+(ang1+j*cur))/57.3)*fsfi*.07; ypo+=Math.cos((deg1+(ang1+j*cur))/57.3)*fsfi*.07; fsbi=fsfi*1.3; if (ypo>shi || xpo<0 || xpo>swi) j=jlen; if (aura) { ret+="<DIV id='arg"+j+"' style='position:absolute; left:"+(xpo-fsbi*.125)+"; top:"+(ypo-fsbi*.85)+"; font-size:"+fsbi+"px; color:rgb(0,0,255); z-Index:0' >.</DIV>"; ct++;} ret+="<DIV style='position:absolute; left:"+(xpo-fsfi*.125)+"; top:"+(ypo-fsfi*.85)+"; font-size:"+fsfi+"px; color:"+bcolor+"; z-Index:1' >.</DIV>"; }ret+="</DIV>"; } } function leg2() { xp=xpo; yp=ypo; lang1=zag*ion*(30+Math.random()*20-10); //ion*=-1; lang2=0; deg2=deg1+ion*50+Math.random()*20-10; klen=Math.random()*nbs/2+nbs/2; // // if (ns4) { for (k=nbs/2;k<klen;k++) { ang2=Math.random()*jag*90-jag*45; if (Math.random()+.05>zag) lang2=Math.random()*zag*90-zag*45; ang2-=lang2; ct++; xp+=Math.sin((deg2+(ang2+k*cur))/57.3)*(fsf*fsii/9)*.07; yp+=Math.cos((deg2+ang2)/57.3)*(fsf*fsii/9)*.07; if (aura) { ol.document.layers["a"+k+"f"+fsii].moveTo(xp-(fsf*1.3*fsii/9)*.125,yp-(fsf*1.3*fsii/9)*.85); ct++;} ol.document.layers["s"+k+"f"+fsii].moveTo(xp-(fsf*fsii/9)*.125,yp-(fsf*fsii/9)*.85); if (yp>shi || xp<0 || xp>swi) k=klen; } } if (ie4 || ns5) { ret+="<DIV id='forki'>"; for (k=nbs/2;k<klen;k++) { ang2=Math.random()*jag*90-jag*45; if (Math.random()+.05>zag) lang2=Math.random()*zag*90-zag*45; ang2-=lang2; ct++; xp+=Math.sin((deg2+(ang2+k*cur))/57.3)*fsfii*.07; yp+=Math.cos((deg2+(ang2+k*cur))/57.3)*fsfii*.07; fsbii=fsfii*1.3; if (yp>shi || xp<0 || xp>swi) k=klen; if (aura) { ret+="<DIV id='arg"+k+"' style='position:absolute; left:"+(xp-fsbii*.125)+"; top:"+(yp-fsbii*.85)+"; font-size:"+fsbii+"px; color:rgb(0,0,255); z-Index:0' >.</DIV>"; ct++;} ret+="<DIV style='position:absolute; left:"+(xp-fsfii*.125)+"; top:"+(yp-fsfii*.85)+"; font-size:"+fsfii+"px; color:"+bcolor+"; z-Index:1' >.</DIV>"; } ret+="</DIV>"; } } function light() { ol.moveTo(pageXOffset,pageYOffset); ol.visibility = "show"; if (flash) document.bgColor=skyFlash; Time2=setTimeout("ning()",(Math.random()*1000+1000)); } function lightie() { ark.style.left=document.body.scrollLeft; ark.style.top=document.body.scrollTop; ark.style.visibility = "visible"; if (flash) document.bgColor=skyFlash; Time2=setTimeout("ningie()",(Math.random()*500+100)); } function ning() { if (flash) document.bgColor=skyNorm; ol.visibility = "hide"; if (Math.random()*3>2) Time2=setTimeout("light()",(Math.random()*500+100)); else { for (fs=1;fs<10;fs++) for (i=1;i<nbs;i++) { if (aura) ol.document.layers["a"+i+"f"+fs].moveTo(-100,-100); ol.document.layers["s"+i+"f"+fs].moveTo(-100,-100); } Time1=setTimeout("mainplot()",(Math.random()*500+100)) } } function ningie() { ark.style.visibility = "hidden"; if (flash) document.bgColor=skyNorm; if (Math.random()*3>2) Time2=setTimeout("lightie()",(Math.random()*500+100)); else Time1=setTimeout("mainplot()",(Math.random()*500+100)); } function format(f){ f+=""; if (f.charAt(0)==".") f="0"+f; if (f.length==1) f+=".00"; if (f.length==3) f+="0"; return f; } function halt() { if (Time1) {clearTimeout(Time1); Time1=null;} if (Time2) {clearTimeout(Time2); Time2=null;} } //--> </SCRIPT> <SCRIPT language=Javascript> <!-- swi=(ie4)? document.body.offsetWidth-17:window.innerWidth; shi=(ie4)? document.body.offsetHeight-4:window.innerHeight; cswi=swi/2; cshi=shi/2; ret="<DIV id='ark' style='position:absolute; left:0; top:0; width:"+swi+"; height:"+shi+"; visibility:visible; z-index=1; overflow:hidden; clip:rect(0,"+(swi)+","+(shi)+",0)'></DIV>"; document.write(ret); //--> </SCRIPT> <br /> </body> </html>
标签:nbsp
版权说明:如有标注说明此文章是本站 小小软件库 原创,转载请注明出处和附带本文链接;
免责声明:
本站提供的资源,都来自网络,版权争议与本站无关,所有内容及软件的文章仅限用于学习和研究目的。不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,我们不保证内容的长久可用性,通过使用本站内容随之而来的风险与本站无关,您必须在下载后的24个小时之内,从您的电脑/手机中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务.
- 上一篇:JS图片切换特效
- 下一篇:常用JS图片滚动(无缝、平滑、上下左右滚动)代码大全
相关推荐
- 10-24防沉迷认证修改
- 10-24淘宝买家秀最新版 各种你懂得买家秀
- 10-06广告合作
取消回复欢迎 你 发表评论:
- 排行榜
- 推荐资讯
-
- 10-13ZFB生活缴费撸能量
- 10-11最新活动公众号领取红包教程都可以可以领取红包
- 10-14新网16元撸cn域名+网站+邮箱
- 10-06掌上wegame 免费抽Q币 非必中 亲测1Q币
- 10-06steam喜+1 游戏开发引擎
- 10-06同程旅行领取8元火车票+休息厅
- 10-06关注中国广州发布公众号 抽随机现金红包
- 10-06LOL欢度中秋 登录游戏领取魄罗图标
- 10-09猫眼领取25减5元电影票券活动
- 10-06免费领7天keep健身运动vip
- 标签列表
- 站点信息
-
- 文章总数:9220
- 页面总数:3
- 分类总数:9
- 标签总数:341
- 评论总数:114
- 浏览总数:285786