Version compl�te: jsB@nk » Multimédia » Evénements » Starfield Simulation
URL: https://www.javascriptbank.com/starfield-simulation.html
Prenez votre page Web dans les étoiles avec ce Animation 3D script d'étoiles! Voyage vers les étoiles vous dans une manière incessante.
Version compl�te: jsB@nk » Multimédia » Evénements » Starfield Simulation
URL: https://www.javascriptbank.com/starfield-simulation.html
<style type="text/css">body{background-color:black;font:bold 10pt sans-serif;color:white;}td, li{font:bold 10pt sans-serif;color:white;}.scode{font:bold 10pt serif;color:#eeaaaa}.star{position:absolute;visibility:visible;top:-50px;left:0px;width:50px;height:50px;font-size:1px;}</style><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<script language="javascript">var starnum=80; //NUMBER OF STARS YOU WANT. SMALLER NUMBER GIVES BETTER PERFORMANCE.// LIST OF POSSIBLE STAR COLORS. USE AS MANY OR AS FEW (NEEDS AT LEAST ONE) AS YOU WANT.var starcolors=['#dddddd','#000099','forestgreen','#2222aa','darkyellow'];var star=new Array();var so=new Object();so.ie4=(document.all&&!document.getElementById)?true:false;so.ns4=(document.layers)?true:false;so.ie5=(document.all&&document.getElementById)?true:false;so.ns6=(document.getElementById&&!document.layers&&!document.all)?true:false;so.w3c=(document.getElementById)?true:false;so.tmpx=0; so.tmpy=0;so.xdir=0; so.ydir=0;so.deltax=0; so.deltay=0;so.xoffset=0; so.yoffset=0;so.w_x=0; so.w_y=0;so.scrlx=0; so.scrly=0;function getid(str){if(so.ns4)return document.layers[str];else if(so.ie4)return document.all[str];else if(so.w3c)return document.getElementById(str);}function findwindowparams(){so.w_x=(so.ie4||so.ie5)?document.body.clientWidth:window.innerWidth;so.w_y=(so.ie4||so.ie5)?document.body.clientHeight:window.innerHeight;so.xoffset=Math.floor(so.w_x/2);so.yoffset=Math.floor(so.w_y/2);for(i=1;i<=starnum;i++)getstartpos(i);}function getstartpos(n){var sN=star[n];sN.deltay=Math.floor(Math.random()*15);sN.deltax=Math.floor(Math.random()*15);sN.sv=(sN.deltax+sN.deltay)/2+1;sN.xdir=(Math.floor(Math.random()*2)==1)?true:false;sN.ydir=(Math.floor(Math.random()*2)==1)?true:false;sN.ctr=0;var tsx=(so.ie4||so.ie5)?document.body.scrollLeft:pageXOffset;var tsy=(so.ie4||so.ie5)?document.body.scrollTop:pageYOffset;if(so.ns4){sN.clip.width=sN.clip.height=0;sN.moveTo(so.xoffset+tsx,so.yoffset+tsy);}else{sN.style.width=sN.style.height=0; sN.style.top=so.yoffset+tsy+'px';sN.style.left=so.xoffset+tsx+'px';}}function movestar(){for(i=1;i<=starnum;i++){var sN=star[i];sN.ctr+=sN.sv/70;so.tmpx=sN.deltax*sN.ctr+sN.ctr;so.tmpy=sN.deltay*sN.ctr+sN.ctr;so.scrlx=(so.ie4||so.ie5)?document.body.scrollLeft:pageXOffset;so.scrly=(so.ie4||so.ie5)?document.body.scrollTop:pageYOffset;var tc=(sN.ctr>.9)?Math.max(1,(sN.ctr/1)):0;var tx=(so.ns4)?sN.left:parseInt(sN.style.left);var ty=(so.ns4)?sN.top:parseInt(sN.style.top);if(so.ns4){sN.clip.width=sN.clip.height=tc;if((tx+so.tmpx+tc>=so.w_x+so.scrlx)||(ty+so.tmpy+tc>=so.w_y+so.scrly)||(tx-so.tmpx*1.2<=so.scrlx)||(ty-so.tmpy*1.5<=so.scrly))getstartpos(i);else sN.moveBy(((sN.xdir)?so.tmpx:-so.tmpx), ((sN.ydir)?so.tmpy:-so.tmpy));}else{sN.style.width=sN.style.height=tc;if((tx+so.tmpx+tc>=so.w_x+so.scrlx)||(ty+so.tmpy+tc>=so.w_y+so.scrly)||(tx-so.tmpx*1.2<=so.scrlx)||(ty-so.tmpy*1.5<=so.scrly))getstartpos(i);else{sN.style.top=ty+((sN.ydir)?so.tmpy:-so.tmpy)+'px';sN.style.left=tx+((sN.xdir)?so.tmpx:-so.tmpx)+'px';}}}}window.onresize=function(){if(so.ns4)setTimeout('history.go(0)',200);else findwindowparams();}window.onload=function(){for(i=1;i<=starnum;i++)star[i]=getid('star'+i);findwindowparams();var d=(so.ns6)?50:80;setInterval('movestar()',d);}function writestars(){var tc;var txt='';for(i=1;i<=starnum;i++){tc=starcolors[Math.floor(Math.random()*starcolors.length)];txt+='<div id="star'+i+'" class="star" style="background-color:'+tc+'; layer-background-color:'+tc+'"></div>';}return txt;}document.write(writestars());</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->