<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="res/louzoom_4.css" media="screen"> <script type="text/javascript" language="JavaScript"> //3D Starfield - by Mikhail Ansolis, based on Flying planes - by John Ely //Modified from: Autumn leaves script- by Kurt Grigg (kurt.grigg@virgin.net) //Visit http://www.dynamicdrive.com for this script //Pre-load your image below! //CHANGE 5 to the number of images listed below grphcs=new Array(5) //PRELOAD the involved images (extend or contract variables according to # of images used) Image0=new Image(); Image0.src=grphcs[0]="floplay.gif" Image1=new Image(); Image1.src=grphcs[1]="floplay.gif" Image2=new Image(); Image2.src=grphcs[2]="floplay.gif" Image3=new Image(); Image3.src=grphcs[3]="floplay.gif" Image4=new Image(); Image4.src=grphcs[4]="floplay.gif" //SPECIFY number of images to randomly display concurrently from list above. Less the more efficient Amount=3; Ypos=new Array(); Xpos=new Array(); Zpos=new Array(); //SpeedX=new Array(); //SpeedY=new Array(); ScrXpos=new Array(); ScrYpos=new Array(); Speed=new Array(); Size=new Array(); Step=new Array(); ns=(document.layers)?1:0; ie=document.all&&navigator.userAgent.indexOf("Opera")==-1 document.write(' '); for (i = 0; i < Amount; i++){ document.write(''); } document.write(' '); //initialize star properties WinHeight=document.documentElement.clientHeight; WinWidth=document.documentElement.clientWidth; for (i=0; i < Amount; i++){ Speed[i]=(i+1)*6/Amount+4; //speed range from 4 to 10 Xpos[i] = (Math.random()*WinWidth-WinWidth/2)*(Amount-i/3)/Amount; Ypos[i] = (Math.random()*WinHeight-WinHeight/2)*(Amount-i/3)/Amount; Zpos[i] = Math.random()*900*(Amount-i/3)/Amount+100; } function fly(){ var dde=(navigator.vendor) ? document.body : document.documentElement; var WinHeight=document.documentElement.clientHeight; var WinWidth=document.documentElement.clientWidth; var hscrll=dde.scrollTop; for (i=0; i < Amount; i++){ Zpos[i]-=Speed[i]; if (ScrXpos[i]>WinWidth || ScrXpos[i]<0 || ScrYpos[i]>WinHeight || ScrYpos[i]<0 || Zpos[i]<=0) { //generate new stars Speed[i]=(i+1)*6/Amount+4; //speed range from 4 to 10 Xpos[i] = (Math.random()*WinWidth-WinWidth/2)*(Amount-i/3)/Amount; Ypos[i] = (Math.random()*WinHeight-WinHeight/2)*(Amount-i/3)/Amount; Zpos[i] = Math.random()*900*(Amount-i/3)/Amount+100; } ScrXpos[i]=Xpos[i]/Zpos[i]*100 + WinWidth/2; ScrYpos[i]=Ypos[i]/Zpos[i]*100 + WinHeight/2; document.getElementById('si'+i).style.left=ScrXpos[i]+'px'; document.getElementById('si'+i).style.top=ScrYpos[i]+hscrll+'px'; } //end for setTimeout('fly()',20); } //end fly window.onload=fly //--> </script> </head>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionfunction iMouse(){ my=event.y;mx=event.x; } document.onmousemove=iMouse
unction iMouse(evt){ evt=(!evt) ? event : evt; var dde=(navigator.vendor) ? document.body : document.documentElement; mx =evt.clientX + dde.scrollLeft; my =evt.clientY + dde.scrollTop; } if(parseInt(navigator.userAgent.substring(30,31))<=8){ document.documentElement.attachEvent('onmousemove', iMouse); } else{ document.documentElement.addEventListener("mousemove", iMouse, false); }
layer.top= Ydelay+100*Math.sin((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px'; layer.left=Xdelay+180*Math.cos((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px';
ie.style.top=document.body.scrollTop;
document.getElementById('ie').style.top=dde.scrollTop;
for (i=0; i < amount; i++) { var layer=iestars[i].style; layer.filter='glow(color='+colours[i]+', strength='+ini+')'; layer.top= Ydelay+100*Math.sin((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10); layer.left=Xdelay+180*Math.cos((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10); }
var layer=iestars[i].style;
var layer=document.getElementById('ie2').getElementsByTagName('div')[i].style
(getElementsByTagName('div')[i])
for (i=0; i < amount; i++) { var layer=document.getElementById('ie2').getElementsByTagName('div')[i].style layer.filter='glow(color='+colours[i]+', strength='+ini+')'; layer.top= Ydelay+100*Math.sin((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px'; layer.left=Xdelay+180*Math.cos((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px'; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type" /> <title>sans titre 2</title> </head> <script language="JavaScript"> <!-- Mouse Stars 3 Script by kurt.grigg@virgin.net //To add more stars simply add more colours in below array!! colours=new Array('#C5321B','#F1A91C','#F1A91C','#C5321B','#F1A91C','#F1A91C','#C5321B') //Alter nothing below!! amount=colours.length; YgetDelay=0,XgetDelay=0,Ydelay=0,Xdelay=0,step=0.2,currStep=0,my=0,mx=0; document.write(' '); for (i=0; i < amount; i++) document.write(' . '); document.write(' '); ini=1; gstep=1; function iMouse(evt){ evt=(!evt) ? event : evt; var dde=(navigator.vendor) ? document.body : document.documentElement; mx =evt.clientX + dde.scrollLeft; my =evt.clientY + dde.scrollTop; } if(parseInt(navigator.userAgent.substring(30,31))<=8){ document.documentElement.attachEvent('onmousemove', iMouse); } else{ document.documentElement.addEventListener("mousemove", iMouse, false); } function dim(){ ini-=gstep; dt=setTimeout('dim()',10); if (ini < 2){ clearTimeout(dt); glow(); } } function glow(){ ini+=gstep; gt=setTimeout('glow()',10); if (ini > 14){ clearTimeout(gt); dim(); } } function stars(){ var dde=(navigator.vendor) ? document.body : document.documentElement; document.getElementById('ie').style.top=dde.scrollTop; for (i=0; i < amount; i++) { var layer=document.getElementById('ie2').getElementsByTagName('div')[i].style layer.backgroundColor='red'; layer.filter='glow(color='+colours[i]+', strength='+ini+')'; layer.top= Ydelay+100*Math.sin((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px'; layer.left=Xdelay+180*Math.cos((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px'; } currStep+=step; } function delay(){ Ydelay = YgetDelay+=(my-YgetDelay)*1/20; Xdelay = XgetDelay+=(mx-XgetDelay)*1/20; stars(); setTimeout('delay()',10); } delay(); glow(); //--> </script> </html>
function iMouse(evt){ evt=(!evt) ? event : evt; mx =evt.clientX ; my =evt.clientY; }
colours=new Array('Star0.gif','star1.gif','star2.gif','star3.gif','star4.gif','star5.gif','star6.gif')
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type" /> <title>sans titre 2</title> </head> <script language="JavaScript"> <!-- Mouse Stars 3 Script by kurt.grigg@virgin.net colours=new Array('Star0.gif','star1.gif','star2.gif','star3.gif','star4.gif','star5.gif','star6.gif') //Alter nothing below!! YgetDelay=0,XgetDelay=0,Ydelay=0,Xdelay=0,step=0.2,currStep=0,my=0,mx=0; document.write(' '); for (i=0; i < colours.length; i++) document.write(''); document.write(' '); ini=1; function iMouse(evt){ evt=(!evt) ? event : evt; mx =evt.clientX ; my =evt.clientY; } if(parseInt(navigator.userAgent.substring(30,31))<=8){ document.documentElement.attachEvent('onmousemove', iMouse); } else{ document.documentElement.addEventListener("mousemove", iMouse, false); } function dim(){ ini-=1; dt=setTimeout('dim()',50); if (ini < 5){ clearTimeout(dt); glow(); } } function glow(){ ini+=1; gt=setTimeout('glow()',50); if (ini > 30){ clearTimeout(gt); dim(); } } function stars(){ var dde=(navigator.vendor) ? document.body : document.documentElement; document.getElementById('ie').style.top=dde.scrollTop; for (i=0; i < colours.length; i++) { var layer=document.getElementById('ie2').getElementsByTagName('img')[i].style layer.width=ini+'px'; layer.height=ini+'px'; layer.top= Ydelay+100*Math.sin((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px'; layer.left=Xdelay+180*Math.cos((5*Math.sin((currStep-15.99)/10))+i*70)*Math.sin((currStep)/10)*Math.cos((currStep+i*25)/10)+'px'; } currStep+=step; } function delay(){ Ydelay = YgetDelay+=(my-YgetDelay)*1/20; Xdelay = XgetDelay+=(mx-XgetDelay)*1/20; stars(); setTimeout('delay()',10); } delay(); glow(); //--> </script> </html>
Tu as appris tout ça comment ?