»
EnglishFrenchVietnamese

Print - Through the Universe - JavaScriptBank.com

Full version: jsB@nk » Multimedia » Events » Through the Universe
URL: https://www.javascriptbank.com/through-the-universe.html

Through the Universe © JavaScriptBank.comTake your webpage into the stars with this 3D animation starfield script! The stars travel towards you in an incessant manner. This JavaScript uses NO images but using the colorful dots.

Full version: jsB@nk » Multimedia » Events » Through the Universe
URL: https://www.javascriptbank.com/through-the-universe.html



JavaScript
<SCRIPT language=JavaScript><!--starColors=new Array('#FFFFFF','#99CCFF','#FFFF00','#99CCFF','#FF9999'); //moving stars color arraynStars=27; //number of moving starsnFarStars=45; //number of background starsstarSpeed=200; //moving star refresh speedstarConst=0.02; //moving star speedcenterSpot=0.4; //dissolv center spotbgstarscolor='#FFFF00'; //background stars color//do not edit below thisns4 = (document.layers)? true:false;ie4 = (document.all)? true:false;DynLayerTest.count=0;DynLayerInit.nestRefArray=new Array();DynLayerInit.refArray=new Array();DynLayerInit.refArray.i=0;DynLayerInit.set=false;function DynLayer(id,nestref,frame) {  if (!DynLayerInit.set && !frame) DynLayerInit()  if (ns4) {if (!frame) { if (!nestref) var nestref = DynLayerInit.nestRefArray[id]  if (!DynLayerTest(id,nestref)) return this.css=(nestref)? eval("document."+nestref+".document."+id) : document.layers[id]}else this.css=(nestref)? eval("parent."+frame+".document."+nestref+".document."+id) : parent.frames[frame].document.layers[id]this.x=this.css.left;this.y=this.css.top;}else if (ie4) {this.css=(frame)? parent.frames[frame].document.all[id].style : document.all[id].style;this.x=this.css.pixelLeft;this.y=this.css.pixelTop;}this.id=id;this.w=(ns4)? this.css.clip.width : this.css.pixelWidth;this.h=(ns4)? this.css.clip.height : this.css.pixelHeight;this.doc=(ns4)? this.css.document : document;if (ns4) this.event=this.css;if (ie4) this.event=(frame)? parent.frames[frame].document.all[id] : document.all[id];this.obj=id+"DynLayer"eval(this.obj+"=this")this.moveTo=DynLayerMoveTo;this.moveBy=DynLayerMoveBy;this.show=DynLayerShow;this.hide=DynLayerHide;this.slideInit=DynLayerSlideInit;this.clipInit=DynLayerClipInit;this.write=DynLayerWrite;}function DynLayerTest(id,nestref) {var ref = new Array()if (nestref) ref = nestref.split('.document.')ref[ref.length] = idvar refstr = (ns4)? 'document.'+ref[0] : 'document.all.'+ref[0]for (var i=1; i<=ref.length; i++) {if (eval(refstr)) {if (ref.length==i) return trueelse refstr += (ns4)? '.document.'+ref[i] : '.all.'+ref[i]}else {var str ='DynLayer Error:'for (j in ref) {str += '\n'+ref[j]if (j==i-1) str += '  <-- this layer cannot be found'}if (DynLayerTest.count++<5) alert(str)else alert("Too many DynLayer errors, quitting.")return false}}return false}function DynLayerInit(nestref) {if (!DynLayerInit.set) DynLayerInit.set = trueif (ns4) {if (nestref) ref = eval('document.'+nestref+'.document')else {nestref = ''; ref = document;}for (var i=0; i<ref.layers.length; i++) {var divname = ref.layers[i].nameDynLayerInit.nestRefArray[divname] = nestrefvar index = divname.indexOf("Div")if (index > 0) {eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')}if (ref.layers[i].document.layers.length > 0) {DynLayerInit.refArray[DynLayerInit.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name}}if (DynLayerInit.refArray.i < DynLayerInit.refArray.length) {DynLayerInit(DynLayerInit.refArray[DynLayerInit.refArray.i++])}}else if (ie4) {for (var i=0; i<document.all.tags("DIV").length; i++) {var divname = document.all.tags("DIV")[i].idvar index = divname.indexOf("Div")if (index > 0) {eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')}}}return true}function DynLayerMoveTo(x,y) {if (x!=null) {this.x = xthis.css.left = this.x}if (y!=null) {this.y = ythis.css.top = this.y}}function DynLayerMoveBy(x,y) {this.moveTo(this.x+x,this.y+y)}function DynLayerShow() {this.css.visibility = (ns4)? "show" : "visible"}function DynLayerHide() {this.css.visibility = (ns4)? "hide" : "hidden"}function DynLayerSlideInit() {this.slideTo = DynLayerSlideTo;this.slideBy = DynLayerSlideBy;this.slideStart = DynLayerSlideStart;this.slide = DynLayerSlide;   this.onSlide = new Function("");this.onSlideEnd = new Function("");}function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {this.clipTo = DynLayerClipTothis.clipBy = DynLayerClipBythis.clipValues = DynLayerClipValuesif (ie4) {if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)else this.clipTo(0,this.w,this.h,0)}}function DynLayerWrite(html) {if (ns4) {this.doc.open();this.doc.write(html);this.doc.close();}else if (ie4) {this.event.innerHTML = html}}function initStars() { xc=0.5*winW; yc=0.5*winH; for (var i=0;i<nFarStars;i++) {  createStar('farStar'+i+'Div',winW*Math.random(),winH*Math.random(),1,bgstarscolor,1); } for (var i=0;i<nStars;i++) {  starSize=1+i%2;  createStar('star'+i+'Div',winW*Math.random(),winH*Math.random(),starSize,starColors[i%starColors.length],1)  eval('star'+i+' = new DynLayer("star'+i+'Div")') } setTimeout("moveStars()",starSpeed);}function moveStars() { for (var i=0;i<nStars;i++) {  starCoeff=starConst*(1+i%2);  newX=eval('star'+i+'.x')*(1+starCoeff)-xc*starCoeff;  newY=eval('star'+i+'.y')*(1+starCoeff)-yc*starCoeff;  if (newX<0 || newX>winW || newY<0 || newY>winH) {   newX=winW*(0.5+(Math.random()-0.5)*centerSpot);   newY=winH*(0.5+(Math.random()-0.5)*centerSpot);  }  eval('star'+i+'.moveTo(newX,newY)'); } setTimeout("moveStars()",starSpeed);}function createStar(id,left,top,size,bgColor,zIndex) { if (ns4) {  var lyr = document.layers[id] = new Layer(size);  eval("document."+id+" = lyr");  lyr.name= id;  lyr.left= left;  lyr.top = top;  lyr.clip.height= size;  lyr.bgColor= bgColor;  lyr.visibility= 'show';  lyr.zIndex= zIndex; } else if (ie4) {  var str= '\n<DIV id='+id+' style="position:absolute; left:'+left+'; top:'+top+'; width:'+size;  str+='; height:'+size;  str+='; clip:rect(0,'+size+','+size+',0)';  str+='; background-color:'+bgColor;  str+='; z-index:'+zIndex;  str+='; visibility:visible';  str+=';"></DIV>';  document.body.insertAdjacentHTML("BeforeEnd",str); }}function reloadFromCache() {if(bodyLoaded){self.location=''+self.location} }if (ns4||ie4) window.onresize=reloadFromCache;if (ns4){ winW=window.innerWidth-17; winH=window.innerHeight-17;}if (ie4){ winW=document.body.offsetWidth-22; winH=document.body.offsetHeight-22;}if (ns4 || ie4) setTimeout("initStars()",100);//not using in this scriptif(ie4) string='<h1 align="center"><b><font face="Arial Black">Through the Universe</font></b></h1><div style="position:absolute;width:100%;top:85%;text-align:center;font-family:Arial Black;font-size:30px;font-weight:bold"><a href="http://JavaScriptBank.com">JavaScriptBank.com</a></div>';if (ns4) string='<h1 align="center"><b><font face="Arial Black">Through the Universe</font></b></h1><br><br><br><br><br><p align="center"><font face="Arial Black" size=7><a href="http://JavaScriptBank.com">Free JavaScripts</a></font></p>';document.write(string);//--></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->