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.
What is the mechanism/algorithm involved in functions that perform a fade of some sort?
Share
Very very simply put, it’s usually a function setting the
opacityCSS property gradually (i = i+1) from one value (0…100) to another.A
setIntervalmakes 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.)