Spacetime

Moderator: HTML-Laie

Antworten
Benutzeravatar
Hape
Administrator
Beiträge: 336
Registriert: Fr 22. Mai 2020, 00:33

Spacetime

Beitrag von Hape »

In den Body-Tag einfügen bzw. diesen erweitern:

Code: Alles auswählen

<body background="starbg.jpg">
Script:

Code: Alles auswählen

<SCRIPT language="JavaScript">
// This script to be inserted after <BODY> tag \\

// Star Track - with Warp Speed \\
// This script and many more from :
// http://rainbow.arch.scriptmania.com

//----  Make Changes Here   ----\\

numb_s=20                 // - number of stars (we have 20).
speed_s=3                 // - movement speed of stars

//----  DO  NOT  Change  Below  this line ----\\

//This and others free scripts at - http://rainbow.arch.scriptmania.com
//The script works both with Internet Explorer (4-6) and with Netscape (4,6).

ns=document.layers?1:0
ie=document.all?1:0
ns6=document.getElementById&&!document.all?1:0
function moveSlide(name,sLeft, sTop) {
 if (ns) {document.layers[name].top=sTop;document.layers[name].left=sLeft}
 if (ie) {document.all[name].style.top=sTop;document.all[name].style.left=sLeft}
 if (ns6) {document.getElementById(name).style.top=sTop;document.getElementById(name).style.left=sLeft}
}
function sizeSlide(name,sWdh, sHgt) {
 if (ns){document.layers[name].clip.width=sWdh; document.layers[name].clip.height=sHgt}
 if (ie){document.all[name].style.width=sWdh; document.all[name].style.height=sHgt}
 if (ns6){document.getElementById(name).style.width=sWdh; document.getElementById(name).style.height=sHgt}
}
function positions(){
 hei_scr=(ie)?window.document.body.clientHeight:window.innerHeight
 wid_scr=(ie)?window.document.body.clientWidth:window.innerWidth
 y_scrl=(ie)?document.body.scrollTop:window.pageYOffset
 x_scrl=(ie)?document.body.scrollLeft:window.pageXOffset
}
posX=new Array()
posY=new Array()
posR=new Array()
radi=new Array()
tx=""
positions()
if (ns)
{
        tx=tx+"<layer z-Index=100 left="+(wid_scr-35)+" top="+(hei_scr-35)+" ></layer>"
}
else
{
        document.write("<div>.</div>")
}
for (i=0; i<numb_s;i++)
 {
 posY[i]=hei_scr/2
 posX[i]=wid_scr/2
 posR[i]=Math.random()*6.283
 radi[i]=0
 if (ns)
  {
  tx+="<layer z-Index=0 name=star_"+i+" left=0 top=0 width=1 height=1 bgColor=#ffffff></layer>"
  }
  else
  {
  document.write("<div id=star_"+i+"  style='z-index:0; position:absolute; left:0;top:0;width:1;height:1;background:#ffffff'><img  width=1 height=1></div>")
  }
 if(ns){document.write (tx);tx=""}
}
function go_stars(){
positions()
rad_max=Math.sqrt(wid_scr*wid_scr+hei_scr*hei_scr)/2
for (i=0; i < numb_s;i++){
 rad=Math.sqrt(Math.pow((posY[i]-hei_scr/2),2)+Math.pow((posX[i]-wid_scr/2),2))/rad_max*4+1
 posY[i]+=Math.round(Math.sin(posR[i])*rad*speed_s);
 posX[i]+=Math.round(Math.cos(posR[i])*rad*speed_s);
 if ((posX[i] > wid_scr-rad*2) || (posY[i] < 0 ) || (posY[i] > hei_scr-rad*2) || (posX[i] < 0))
  {
  posY[i]=hei_scr/2
  posX[i]=wid_scr/2
  posR[i]=Math.random()*6.283
  sizeSlide("star_"+i,1,1)
  moveSlide("star_"+i,posX[i]+x_scrl,posY[i]+y_scrl)
  }
 else{
  if(Math.floor(rad)!=radi[i]){sizeSlide("star_"+i,rad,rad);radi[i]=rad}
  moveSlide("star_"+i,posX[i]+x_scrl,posY[i]+y_scrl)
  }
 }
}
starSpeed=setInterval('go_stars()',15);

// end script


function ch_speed(new_speed){clearInterval(starSpeed); starSpeed=setInterval('go_stars()',new_speed);}

</SCRIPT>
Demoseite hierzu: https://hapes-javascript-demo-page.hpag ... etime.html
Dateianhänge
starbg.jpg
starbg.jpg (2.72 KiB) 5261 mal betrachtet

Antworten