Починил вроде. Всем спасибо за помощь.
( function () {
var Anim = {};
Anim.fxHelper = function ( elem, attr, to, dur ) {
var from = getComputedStyle( elem )[attr];
from = +from.replace( "px", "" );
var start = new Date().getTime();
var animation = function () {
var m = (new Date().getTime() - start) / dur;
if (m > 1) m = 1;
elem.style[attr] = from + (to - from) * m;
if (m < 1) setTimeout( animation, 10 );
};
setTimeout( animation, 10 );
};
Anim.fx = function ( elem, data, dur ) {
for ( var i in data ) {
if ( i.indexOf("olor") != -1 ) {
Anim.color( elem, i, data[i], dur );
continue;
}
Anim.fxHelper( elem, i, data[i], dur );
}
};
Anim.color = function ( elem, attr, to, time ) {
var I = document.createElement( "DIV" );
I.style.backgroundColor = to;
document.body.appendChild( I );
var colorEnd = getComputedStyle( I ).backgroundColor.match( /(\d{1,3})/g );
document.body.removeChild( I );
var colorStart = getComputedStyle( elem )[attr].match( /(\d{1,3})/g );
var start = new Date().getTime();
var animation = function () {
var m = (new Date().getTime() - start) / time;
if (m > 1) m = 1;
elem.style[attr] = "rgb(" + A( colorStart[0], colorEnd[0], m ) + ", " +
A( colorStart[1], colorEnd[1], m ) + ", " +
A( colorStart[2], colorEnd[2], m ) + ")";
if (m < 1) setTimeout( animation, 10 );
};
setTimeout( animation, 10 );
};
function A ( x, y, z ) {
x = +x;
y = +y;
return (x + (y - x) * z).toFixed(0);
}
window.Animate = Anim.fx;
})();