views:

48

answers:

2

What is the mechanism/algorithm involved in functions that perform a fade of some sort? What are some links or resources i can check out when it comes to this matter.

A: 

Since you entered a jQuery tag:

zildjohn01
Ah, the old fadeIn/fadeOut algorithm.
patrick dw
+2  A: 

Very very simply put, it's usually a function setting the opacity CSS property gradually (i = i+1) from one value (0...100) to another.

A setInterval makes sure the function that controls the gradual fading is called every x milliseconds. That way, the fade effect can take place while the page remains functional.

As for resources, you can take a look into how the frameworks do it; however, being highly optimized, their code is probably not good stuff for learning. There were framework-independent fading scripts on sites like DynamicDrive, they should provide a good insight in how this stuff basically works (IIRC, the scripts there were often awful code but still half-way understandable.)

Pekka