Javascript Background Animator


Reminiscent of Netscape 1.1, isn't it?

This is not the world's most complicated JavaScript program ... in fact the hardest part is that I ended up grabbing from the hIadaho ColorCenter (I needed help converting decimal values into hex). The rest of the code is original. I'm not a HUGE fan of background color animation, but it was a fun project to help cut my teeth on, and I know other people used to like them.

Call the function with this command (you do kind of need to copy the function to your page first):

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

The parameters are as follows:

"FFFFFF"

     The first parameter names the BGCOLOR to begin with



"000000"

     The first parameter names the BGCOLOR to end with
25 The last parameter tells the script how many "steps" to use to fade between the first and last BGCOLOR. (25 is fairly flicker free on my system 50 is smoother)

Notes:

  1. You must use hex values ... color names will not work
  2. Don't put a "#" in front of the parameters, just use the Hex values
  3. The larger the last number the smoother the transition will look
  4. You can "stack" bgChanger commands to go from one color to another and another and another (like this page does ... just view the source of this page and reload to see it work)

You're welcome to use the code, just grab the source for this page. You'll notice that I have a Big Ol' Comment ... I'm not requiring you to keep the entire comment, but do ask you leave the last 3 lines of the comment (heck, I need SOME way to draw people to my page ;). If you like the script feel free to send me some mail.


Just click here to return to my Main Page