home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 19 / CDROM19.iso / aplicat / splash / splash10.exe / data1.cab / Plugins / Fade / Fade.plg
Encoding:
Text File  |  1997-12-17  |  1.7 KB  |  79 lines

  1. #Things to add
  2. #    Optional=Yes
  3.  
  4. [Applet Details]
  5. AppletName=Screen Fade
  6. #ClassName=Lake.class
  7. Size=[VARIABLE];50,50
  8. Desc=This plugin fades the screen from one color to another, please note that it will only work on IE4.0 and Netscape 3.0 and above.
  9. PluginAuthor=Andrew Scott
  10. PluginAuthorEmail=andrewcs@beam.com.au
  11. AppletAuthor=Andrew Scott
  12. AppletHomepage=http://www.beam.com.au/
  13.  
  14. #[Button 1]
  15. #Parameter=textstring
  16. #Desc=Enter the text to have scroll across the system bar.
  17. #Type=STRING
  18. #Name=Text to scroll
  19.  
  20. [Onload Block]
  21. fadeout()
  22.  
  23.  
  24. [Head Block]
  25.  
  26. function makearray(n)
  27. {
  28.         this.length = n;
  29.         for(var i;i <= n; i++)
  30.                 this[i] = 0;
  31.         return this;
  32. }
  33.  
  34. hexconvert = new makearray(16);
  35. for(var i=0;i<10;i++)
  36.         hexconvert[i] = i;
  37. hexconvert[10]="a"; hexconvert[11]="b"; hexconvert[12]="c";
  38. hexconvert[13]="d"; hexconvert[14]="e"; hexconvert[15]="f";
  39.  
  40. function hex(i)
  41. {
  42.         if (i<0)
  43.                 return "00";
  44.         else if (i > 255)
  45.                 return "ff";
  46.         else
  47.                 return "" + hexconvert[Math.floor(i/16)] + hexconvert[i%16];
  48. }
  49.  
  50. function setbgColor(r,g,b)
  51. {
  52.         var hr=hex(r); var hg =hex(g); var hb=hex(b);
  53.         document.bgColor = "#"+hr+hg+hb;
  54. }
  55.  
  56. function fade(sr,sg,sb,er,eg,eb,step)
  57. {
  58.         for(var i=0;i<=step;i++)
  59.         {
  60.                 setbgColor(
  61.                 Math.floor(sr*((step-i)/step)+er*(i/step)),
  62.                 Math.floor(sg*((step-i)/step)+eg*(i/step)),
  63.                 Math.floor(sb*((step-i)/step)+eb*(i/step)));
  64.         }
  65. }
  66.  
  67. function fadein()
  68. {
  69.         fade(255,255,255,0,0,0,16);
  70. }
  71.  
  72. function fadeout()
  73. {
  74.         fade(0,0,0,255,255,255,16);
  75. }
  76.  
  77.  fadeout();
  78.  
  79.