JavaScript Source Code 3000: BG Effects: Particle Field
Particle Field
(IE Only) Illustrates movement of stars (or snow) depending on the direction of the mouse. Awesome!
\n";
if (ns4) ret+="_"; else ret+="";
ret+="";
ret+="";
ret+="";
document.write(ret);
// End -->
Click here to Stop
JavaScript Source Code 3000: BG Effects: Particle Field
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!
<!-- THREE STEPS TO INSTALL PARTICLE FIELD:
1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Joe Lard (darg36@home.com) -->
<!-- Web Site: http://members.home.net/darg36 -->
<! >
<! >
<!-- Begin
ie4 = document.all?1:0;
ns4 = document.layers?1:0;
ns5 = (document.getElementById && !document.all)?1:0;
time0ID = 0;
time1ID = 0;
time2ID = 0;
wind = 0;
w1 = w2 = -10;
v1 = v2 = -10;
x1 = x2 = -10;
y1 = y2 = -10;
xan = yan = -.25;
// emulate snow or stars? (true | false)
snow = false; // sinewave controlled
star = true; // mouse controlled path
function wave(){ // for snow
xan = Math.sin(wind/57.3);
wind+=Math.random()*5;
if (wind>360) wind = 0;
// yan = .25 // for water
}
// for stars
function mm(e) {
if (ns5) {
xan = ((e.clientX)-csw)/csw;
yan = ((e.clientY)-csh)/csh;
}
else {
xan = (((ns4)?e.pageX:event.x)-csw)/csw;
yan = (((ns4)?e.pageY:event.y)-csh)/csh;
}
}
function init() {
if (ns4) {
z0 = document.zen.document.z0;
z1 = document.zen.document.z1;
}
if (ns5) if (document.getElementsByTagName("*")) {
document.all = document.getElementsByTagName("*")
}
if (star) {
if (ns4 || ns5) {
window.captureEvents(Event.MOUSEMOVE);
window.onmousemove = mm;
}
document.onmousemove = mm;
}
fs=(ns4)? "":"; font-size:25px";
ret=""; tem=(ns4)? "<font size=5>":"";
for (t=1;t<sh/28;t++) {
for (u=1;u<sw/6;u++)
tem += (Math.random()>.99)? ((Math.random()>.9)? "<font size="+((Math.random()*50)+12)+"px>.</font size>":"."):" "; tem += "<BR>";
}
tem += (ns4)? "</font size>":"";
ret += "<div style='position:absolute; left:0px; top:0px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
ret += "<div style='position:absolute; left:"+(sw)+"px; top:0px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
ret += "<div style='position:absolute; left:0px; top:"+(sh)+"px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
ret += "<div style='position:absolute; left:"+(sw)+"px; top:"+(sh)+"px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
if (ns4) {
z0.document.write(ret);
z0.document.close();
}
if (ie4) z0.innerHTML = ret;
if (ns5) document.all.z0.innerHTML = ret;
ret=""; tem=(ns4)? "<font size=5>":"";
for (t = 1; t < sh / 28; t++) {
for (u = 1; u < sw / 6; u++)
tem += (Math.random()>.99)? ((Math.random()>.9)? "<font size="+((Math.random()*50)+12)+"px>.</font size>":"."):" ";
tem+="<BR>";
}
tem += (ns4)? "</font size>":"";
ret += "<div style='position:absolute; left:0px; top:0px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
ret += "<div style='position:absolute; left:"+(sw)+"px; top:0px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
ret += "<div style='position:absolute; left:0px; top:"+(sh)+"px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
ret += "<div style='position:absolute; left:"+(sw)+"px; top:"+(sh)+"px; width:"+sw+"px; height:"+sh+"px; color:white"+fs+"; font-family:Times'>"+tem+"</DIV>";
if (ns4) {
z1.document.write(ret);
z1.document.close();
}
if (ie4) z1.innerHTML = ret;
if (ns5) {
document.all.z1.innerHTML = ret;
z0 = document.all.z0;
z1 = document.all.z1;
}
time1ID = setInterval('z1m()',33);
time0ID = setInterval('z0m()',55);
if (snow) time2ID=setInterval('wave()',77);
}
function halt() {
if (time1ID) clearInterval(time1ID);
if (time0ID) clearInterval(time0ID);
if (time2ID) clearInterval(time2ID);
}
function z0m() {
x1 -= 4 * xan;
x2 -= 4 * yan;
a = Math.round(x1);
b = Math.round(x2);
if (w1 != a) {
w1 = a;
if (w1 > 0) x1 = w1 = -sw;
if (w1 < -sw) x1 = w1 = 0;
if (!ns4) z0.style.left = w1 + "px";
}
if (w2 != b) {
w2 = b;
if (w2 > 0) x2 = w2 = -sh;
if (w2 < -sh) x2 = w2 = 0;
if (!ns4) z0.style.top = w2 + "px";
}
if (ns4) z0.moveTo(w1,w2);
}
function z1m() {
y1 -= xan;
y2 -= yan;
a1 = Math.round(y1);
b1 = Math.round(y2);
if (v1 != a1) {
v1 = a1;
if (v1 > 0) y1 = v1 = -sw;
if (v1 < -sw) y1 = v1 = 0;
if (!ns4) z1.style.left = v1 + "px";
}
if (v2 != b1) {
v2 = b1;
if (v2 > 0) y2 = v2 = -sh;
if (v2 < -sh) y2 = v2 = 0;
if (!ns4) z1.style.top = v2 + "px";
}
if (ns4) z1.moveTo(v1,v2);
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="init()" onunload="halt()">
<!-- STEP THREE: Copy this code into the BODY of your HTML document -->
<SCRIPT LANGUAGE="JavaScript">
<! >
<! >
<!-- Begin
var sw = (ie4)? document.body.offsetWidth:window.innerWidth;
var sh = (ie4)? document.body.offsetHeight:window.innerHeight;
//sw=200; sh=200; field width and height
var csw = Math.round(sw/2);
var csh = Math.round(sh/2);
ret="<STYLE TYPE='text/css'><!--\n";
ret+="#zen {position:absolute; left:0; top:0; width:"+sw+"; height:"+sh+
"; font-size:3000px; font-family:Times; clip:rect(0,"+(sw)+","+(sh)+
",0); overflow:hidden; z-Index:0}";
ret+="#z0 {position:absolute; left:-10; top:-10; width:"+(sw*2)+
"; height:"+(sh*2)+"; clip:rect(0,"+(sw*2)+","+(sh*2)+",0)}";
ret+="#z1 {position:absolute; left:-10; top:-10; width:"+(sw*2)+
"; height:"+(sh*2)+"; clip:rect(0,"+(sw*2)+","+(sh*2)+",0)}";
ret+="#ar {position:absolute; left:10; top:10; width:100; height:100;"+
" z-Index:1000; color:red}";
ret+="//-->\n</STYLE>";
if (ns4) ret+="<DIV id=zen>_"; else ret+="<DIV id=zen>";
ret+="<DIV id=z1></DIV>";
ret+="<DIV id=z0></DIV>";
ret+="</DIV>";
document.write(ret);
// End -->
</script>
<DIV id=ar><a href="javascript:halt()"> </A></DIV>
<!-- Script Size: 6.50 KB -->
Wyszukiwarka
Podobne podstrony:
Particle Handling by Electric Fieldfunction fdf next field nameManaging Producing FieldMazda5 Filtro Particulas Dieselfunction ingres field typefunction ingres field lengthJames A Field The Progress of Eugenicsjp particles(1)Lovstadt, Svensson Diffracted sound field from an orchestra pitwięcej podobnych podstron