RGB Color fade Algorithm

RGB Color fade Algorithm

RGB Color fading algorithm

rgb(255,0,0)

       
(CSS)

link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css'>
style>
#color{
  color: red;
}
body{
  background-color: #112;
  color: white;
}
/style>

(JAVA)

script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'
      script id="rendered-js" >
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);
       
 

Comments