[MouseStars]

Bunte Lichtpunkte umkreisen den Mauszeiger...

[Kompatibilität]

[zwischen <BODY> und </BODY>]

<script language="JavaScript">
<!-- Mouse Stars Script 'adapted for Explorer' by kurt.grigg@virgin.net
/* modified by N8i (www.nightfire.ch)
* Script works now with all DOM compliant browsers */


//Browser Sniffer
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var mozup = (!document.all && document.getElementById) ? 1 : 0;

// Capturing MouseMove
function handlerMM(e) {
Xpos = (ns4up || mozup) ? e.pageX : document.body.scrollLeft+event.clientX
Ypos = (ns4up || mozup) ? e.pageY : document.body.scrollTop+event.clientY
}

if (ns4up) {
window.captureEvents(Event.MOUSEMOVE);
window.onMouseMove = handlerMM;
}
if (ie4up || mozup) {
window.document.onmousemove = handlerMM;
}

var yBase = 200;
var xBase = 200;
var step = .2;
var currStep = 0;
var Xpos = 1;
var Ypos = 1;
var i = 0;
var j = 0;
// ***** konfigurierbarer Bereich ***** //
Clrs=new Array('ffffff','ffff00','ffa000','ff0000','00ff00','0000ff','FF00FF'); // Legen Sie hier die Farben fest
// ***** Ende konfigurierbarer Bereich ***** //

if (ns4up) {
for (i = 0; i < Clrs.length; i++) {
document.write('<LAYER NAME="a'+ i +'" LEFT=10 TOP=10 BGCOLOR="#'+Clrs[i]+'" CLIP="0,0,2,2"></LAYER>')
}
}
if (ie4up) {
document.write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">');
for (i = 0; i < Clrs.length; i++) {
document.write('<div style="position:relative;width:2px;height:2px;background:#'+Clrs[i]+';font-size:2px"></div>')
}
document.write('</div>')
}
if (mozup) {
for (i = 0; i < Clrs.length; i++) {
document.write('<div id="a'+ i +'" style="position:relative;width:2px;height:2px;background:#'+Clrs[i]+';font-size:2px"></div>')
}
}

function animateLogo(){
if (ie4up) {
yBase = window.document.body.offsetHeight/4;
xBase = window.document.body.offsetWidth/4;
}
if (ns4up || mozup) {
yBase = window.innerHeight/4;
xBase = window.innerWidth/4;
}
if (ie4up) {
for ( i = 0 ; i < Clrs.length ; i++ ) {
starsDiv.all[i].style.top = Ypos + Math.cos((20*Math.sin(currStep/20))+i*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + i*25)/10);
starsDiv.all[i].style.left = Xpos + Math.sin((20*Math.sin(currStep/20))+i*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + i*25)/10);
}
}
if (ns4up) {
for ( j = 0 ; j < Clrs.length ; j++ ) { //7 is number of NS layers!
var templayer="a"+j
document.layers[templayer].top = Ypos + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
document.layers[templayer].left =Xpos + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
}
}
if (mozup) {
for ( j = 0 ; j < Clrs.length ; j++ ) {
var templayer="a"+j
document.getElementById(templayer).style.top = Ypos + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
document.getElementById(templayer).style.left =Xpos + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
}
}

currStep += step;
setTimeout("animateLogo()", 10);
}

animateLogo();

// -->
</script>

[Autor]


Kurt Grigg
modified by N8i (www.nightfire.ch)

[Download]

Kopieren Sie bitte den ScriptCode

Copyright © 1998- Nightfire Webworker Archiv Script No: 0195