Posted By

remysharp on 07/24/07


Tagged

textmate fade effect


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

leachypeachy


fadeUp


 / Published in: JavaScript
 

  1. function fadeUp(element, red, green, blue) {
  2. if (element.fade) {
  3. clearTimeout(element.fade);
  4. }
  5. element.style.backgroundColor = "rgb("+red+","+green+","+blue+")";
  6. if (red == 255 && green == 255 && blue == 255) {
  7. return;
  8. }
  9. var newred = red + Math.ceil((255 - red)/10);
  10. var newgreen = green + Math.ceil((255 - green)/10);
  11. var newblue = blue + Math.ceil((255 - blue)/10);
  12. var repeat = function() {
  13. fadeUp(element,newred,newgreen,newblue);
  14. };
  15. element.fade = setTimeout(repeat,100);
  16. }

Report this snippet  

You need to login to post a comment.