/*
* Schnee-Script
* @author Oliver Schlöbe <scripts@schloebe.de>
* @example http://www.schloebe.de/scriptdemos/schloebe_snow/snowtest.html
* @link http://www.schloebe.de/scripts/schnee-script/
* @since 111112
*/
var schloebesnow = {
no: 15, // Anzahl der Schneeflocken
speed: 20, // "Schnei-Geschwindigkeit"; je kleiner die Zahl, um so schneller fallen die Flocken
snowflake: "http://www.schloebe.de/wp-content/themes/schloebe_de/images/snow/snow.gif", // Bild der Schneeflocke, beliebig
/*********************************/
/** Ab hier nichts mehr ändern! **/
/*********************************/
ns4up: (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4") ? 1 : 0, // Browser Tester
ie4up: (document.all) ? 1 : 0,
ns6up: (document.getElementById&&!document.all) ? 1 : 0,
i: 0,
dx: new Array(),
xp: new Array(),
yp: new Array(),
am: new Array(),
stx: new Array(),
sty: new Array(),
doc_width: 800,
doc_height: 800,
let_it_snow: function() {
if( this.ns4up || this.ns6up ) { // Bildschirm-Auflösung holen, Netscape-Funktion
this.doc_width = self.innerWidth;
this.doc_height = self.innerHeight;
} else if( this.ie4up ) { // Bildschirm-Auflösung holen, Internet Explorer-Funktion
this.doc_width = document.body.clientWidth;
this.doc_height = document.body.clientHeight;
}
this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
for( this.i = 0; this.i < this.no; ++ this.i ) {
this.dx[this.i] = 0; // Koordinaten-Variable setzen
this.xp[this.i] = Math.random()*(this.doc_width-50); // Position-Variable setzen
this.yp[this.i] = Math.random()*this.doc_height;
this.am[this.i] = Math.random()*20; // Amplituden-Variable setzten
this.stx[this.i] = 0.02 + Math.random()/10; // Variable für Schrittweite setzen
this.sty[this.i] = 0.7 + Math.random(); // Variable für Schrittweite setzen
if( this.ns4up ) {
if (this.i == 0) {
document.write("<layer name=\"dot"+ this.i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(this.snowflake + "\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ this.i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(this.snowflake + "\" border=\"0\"></layer>");
}
} else if( this.ie4up || this.ns6up ) {
if (this.i == 0) {
document.write("<div id=\"dot"+ this.i +"\" style=\"position: ");
document.write("absolute; z-index: "+ this.i +"; visibility: ");
document.write("visible; top: 15px; left: 15px;\"><img src=\"");
document.write(this.snowflake + "\" border=\"0\"></div>");
} else {
document.write("<div id=\"dot"+ this.i +"\" style=\"position: ");
document.write("absolute; z-index: "+ this.i +"; visibility: ");
document.write("visible; top: 15px; left: 15px;\"><img src=\"");
document.write(this.snowflake + "\" border=\"0\"></div>");
}
}
}
if( this.ns4up ) {
this.snowNS();
} else if( this.ie4up ) {
this.snowIE();
}else if( this.ns6up ) {
this.snowNS6();
}
},
/*
* Haupt-Animations-Funktion für Netscape
*/
snowNS: function() {
for( this.i = 0; this.i < this.no; ++ this.i ) {
this.yp[this.i] += this.sty[this.i];
if( this.yp[this.i] > this.doc_height-50 ) {
this.xp[this.i] = Math.random()*(this.doc_width-this.am[this.i]-30);
this.yp[this.i] = 0;
this.stx[this.i] = 0.02 + Math.random()/10;
this.sty[this.i] = 0.7 + Math.random();
this.doc_width = self.innerWidth;
this.doc_height = self.innerHeight;
this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
}
this.dx[this.i] += this.stx[this.i];
document.layers["dot"+this.i].top = this.yp[this.i];
document.layers["dot"+this.i].left = this.xp[this.i] + this.am[this.i]*Math.sin(this.dx[this.i]);
}
setTimeout("schloebesnow.snowNS()", this.speed);
},
/*
* Haupt-Animations-Funktion für Internet Explorer
*/
snowIE: function() {
for( this.i = 0; this.i < this.no; ++ this.i ) {
this.yp[this.i] += this.sty[this.i];
if( this.yp[this.i] > this.doc_height-50 ) {
this.xp[this.i] = Math.random()*(this.doc_width-this.am[this.i]-30);
this.yp[this.i] = 0;
this.stx[this.i] = 0.02 + Math.random()/10;
this.sty[this.i] = 0.7 + Math.random();
this.doc_width = document.body.clientWidth;
this.doc_height = document.body.clientHeight;
this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
}
this.dx[this.i] += this.stx[this.i];
document.all["dot"+this.i].style.pixelTop = this.yp[this.i];
document.all["dot"+this.i].style.pixelLeft = this.xp[this.i] + this.am[this.i]*Math.sin(this.dx[this.i]);
}
setTimeout("schloebesnow.snowIE()", this.speed);
},
/*
* Haupt-Animations-Funktion für Netscape6 und Mozilla
*/
snowNS6: function() {
for( this.i = 0; this.i < this.no; ++ this.i ) {
this.yp[this.i] += this.sty[this.i];
if( this.yp[this.i] > this.doc_height-50 ) {
this.xp[this.i] = Math.random()*(this.doc_width-this.am[this.i]-30);
this.yp[this.i] = 0;
this.stx[this.i] = 0.02 + Math.random()/10;
this.sty[this.i] = 0.7 + Math.random();
this.doc_width = self.innerWidth;
this.doc_height = self.innerHeight;
this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
}
this.dx[this.i] += this.stx[this.i];
document.getElementById("dot"+this.i).style.top = this.yp[this.i]+"px";
document.getElementById("dot"+this.i).style.left = this.xp[this.i] + this.am[this.i]*Math.sin(this.dx[this.i])+"px";
}
setTimeout("schloebesnow.snowNS6()", this.speed);
}
}
schloebesnow.let_it_snow();
|
Fotoalbum: . - Night Dreamer
Diese Bildergalerie enthält noch keine Fotoalben Sie haben nicht die Berechtigung, Alben zu erstellen.
Besucher
0 Mitglieder und 9 Gäste sind Online
Wir begrüßen unser neuestes Mitglied: bill74
|
Forum Statistiken
Das Forum hat 949
Themen
und
1737
Beiträge.
Heute waren 0 Mitglieder Online:
|
|