I was trying to create an animation where it loads when the page loads.
Initially it creates object with white background.
Every 1 second, it shifts the object to right by 10px, at mean while change the object color by adding 10 to its RGB value.
I've create this jsFiddle, but it doesn't work (border is to distinguish the object) Any inputs will be largely appreciated.
function RGB2HTML(red, green, blue)
{
var decColor =0x1000000* blue + 0x100 * green + 0x10000 *red ;
return '#'+decColor.toString(16).substr(1);
}
window.onload = function(){
var currentColor='white';
var red = 0;
var green = 0;
var blue =0;
setInterval(function(){
$('.object').style.top += 10px;
$('.object').style.left += 10px;
$('.object').style.background-color = RGB2HTML(red+10; green+10; blue+10)
}, 1000);
};
Here is the jsfiddle: