home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / Www / Zajaczek / motyle.js < prev    next >
Text File  |  2000-03-23  |  2KB  |  51 lines

  1. <!-- Original: freeware.de --><!-- Web Site: http://freeware.de --><!-- This script and many more are available free online at --><!-- The JavaScript Source!! http://javascript.internet.com -->
  2. <!-- Begin 
  3. var ns=document.layers ? 1 : 0;
  4. if (ns) {
  5.  
  6. document.writeln('<P><LAYER NAME="a" LEFT=20 TOP=20 VISIBILITY=SHOW background="img/st1.gif" CLIP="0,0,30,30"></LAYER>');
  7. document.writeln('<LAYER NAME="b" LEFT=30 TOP=30 VISIBILITY=SHOW background="img/st1.gif" CLIP="0,0,30,30"></LAYER>');
  8. document.writeln('<LAYER NAME="c" LEFT=40 TOP=40 VISIBILITY=SHOW background="img/anipix1.gif" CLIP="0,0,50,50"></LAYER>');
  9. document.writeln('<LAYER NAME="d" LEFT=50 TOP=50 VISIBILITY=SHOW background="img/anipix2.gif" CLIP="0,0,70,80"></LAYER>');
  10. document.writeln('<LAYER NAME="e" LEFT=60 TOP=60 VISIBILITY=SHOW background="img/anipix3.gif" CLIP="0,0,60,85"></LAYER></P>');
  11.  
  12.     window.captureEvents(Event.MOUSEMOVE); 
  13.     var yBase = 200; 
  14.     var xBase = 200; 
  15.     var delay = 10; 
  16.     var yAmpl = 10; 
  17.     var yMax = 40; 
  18.     var step = .2; 
  19.     var ystep = .5; 
  20.     var currStep = 0; 
  21.     var tAmpl=1;
  22.     var Xpos = 50; 
  23.     var Ypos = 50; 
  24.     var j = 0;
  25.  
  26.     function MoveHandler(evnt) {
  27.         Xpos = evnt.pageX; 
  28.         Ypos = evnt.pageY; 
  29.     }
  30.  
  31.     window.onMouseMove = MoveHandler;
  32.  
  33.     function animateLogo() {
  34.         yBase = window.innerHeight/4 ;
  35.         xBase = window.innerWidth/4;
  36.         for ( j = 0 ; j < 5 ; j++ ) {
  37.             document.layers[j].top = Ypos +
  38.            Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*
  39.            (Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
  40.            document.layers[j].left =Xpos +
  41.            Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*
  42.            (Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
  43.         }
  44.         currStep += step; 
  45.         setTimeout("animateLogo()", delay); 
  46.     }
  47.  
  48.     animateLogo(); 
  49. }
  50. // End -->
  51.