I have a js code which changes a css color, but my problem is, that i wan't to change the color smoothly.
HTML:
<html id="html">
Here is the css:
html{
background:radial-gradient(circle, #ffffff, #aaaaaa);
transition:all 5s linear;
}
And thats the simple js:
function changecolor(r,g,b){
var bg = document.getElementById("html");
bg.style.backgroundImage = 'radial-gradient(circle, #ffffff, #'+r+g+b+ ')';
};
And then somewhere in the code:
changecolor(9,0,0);
The color changes perfectly but the transition isn't working. Like I said before I want the color to change smoothly.
Can anyone help me please? Thanks!