ReferencesRGB Color fading algorithm
This program in javascript demonstrates an algorithm for nicely fading an RGB color. The last two or three lines call jQuery functions that are irrelevant to my purposes.
Reference:
codepen.io
var r=255,g=0,b=0;
setInterval(function(){
if(r > 0 && b == 0){
r--;
g++;
}
if(g > 0 && r == 0){
g--;
b++;
}
if(b > 0 && g == 0){
r++;
b--;
}
$("#color").text("rgb("+r+","+g+","+b+")");
$("#color").css("color","rgb("+r+","+g+","+b+")");
},10);
|