Programalama > JAVA SCRIPT

Etiketler: arka, planin, yanip, sönmesi

Ort. 0
Puan ver:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<title>z-arka_planin_yanip_sonmesi-1</title>
</head>

<body>

<p>
<SCRIPT><!--//*********************************************************//

    //                   Background Color Changer                     //

    //                                                                //

    //   Feel free to use/modify this code as needed so long as the   //

    // following message is left intact and included with the script: //

    //                                                                //

    //  This was my first attempt to write a new JavaScript page by   //

    //        myself ... even so I owe the Dec2Hex function to        //

    //                                                                //

    //                 the hIdaho ColorCenter at:                     //

    //         http://www.hidaho.com/colorcenter/ccpad.html           //

    //                                                                //

    //          Original code copyright 1996 Geoff Baysinger          //

    //               http://fly.hiwaay.net/~gbaysing/                 //

    //                     gbaysing@hiwaay.net                        //

    //*************************************************//-->

 

function initArray() {

  this.length = initArray.arguments.length

  for (var i = 0; i < this.length; i++)

    this[i+1] = initArray.arguments[i]

}

 

var hexChars = "0123456789ABCDEF";

 

function Dec2Hex (Dec) {

  var a = Dec % 16;

  var b = (Dec - a)/16;

  hex = "" + hexChars.charAt(b) + hexChars.charAt(a);

  return hex;

}

 

function bgChanger (begin, end, steps) {

  steps = steps -1 ;

 

  redA     = begin.charAt(0) + begin.charAt(1);

  red_valA = parseInt(redA,'16');

  redB     = end.charAt(0) + end.charAt(1);

  red_valB = parseInt(redB,'16');

  red_int  = ((red_valB - red_valA) / steps) * -1;

  grnA     = begin.charAt(2) + begin.charAt(3);

  grn_valA = parseInt(grnA,'16');

  grnB     = end.charAt(2) + end.charAt(3);

  grn_valB = parseInt(grnB,'16');

  grn_int  = ((grn_valB - grn_valA) / steps) * -1;

  bluA     = begin.charAt(4) + begin.charAt(5);

  blu_valA = parseInt(bluA,'16');

  bluB     = end.charAt(4) + end.charAt(5);

  blu_valB = parseInt(bluB,'16');

  blu_int  = ((blu_valB - blu_valA) / steps) * -1;

 

  step = 2;

  red = red_valA;

  grn = grn_valA;

  blu = blu_valA;

 

  document.bgColor = begin;

 

  while ( steps >= step ) {

    red -= red_int;

    red_round = Math.round(red);

    red_hex = Dec2Hex(red);

 

    grn -= grn_int;

    grn_round = Math.round(grn);

    grn_hex = Dec2Hex(grn);

 

    blu -= blu_int;

    blu_round = Math.round(blu);

    blu_hex = Dec2Hex(blu);

 

    document.bgColor = red_hex + grn_hex + blu_hex;

//    document.write("<br>bgcolor = " + red_hex + grn_hex + blu_hex);

 

    step++;

  }

  document.bgColor = end;

}

 

 

<!-- 

// black to black (pause)

  bgChanger("000000","000000",25);

// black to red

  bgChanger("000000","FF0000",50);

// red to purple 

  bgChanger("FF0000","AA00EE",50);

// purple to blue

  bgChanger("AA00EE","0000FF",50);

// blue to green

  bgChanger("0000FF","00FF00",50);

// green to black

  bgChanger("00FF00","000000",50);

// black to black (pause)

  bgChanger("000000","000000",25);

// --></SCRIPT>


</p>

</body>

</html>


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.