dist/jcanvas.js
function _animateColor(fx) {
	var n = 3,
		i;
	// Only parse start and end colors once
	if (typeOf(fx.start) !== 'array') {
		fx.start = _colorToRgbArray(fx.start);
		fx.end = _colorToRgbArray(fx.end);
	}
	fx.now = [];

	// If colors are RGBA, animate transparency
	if (fx.start[3] !== 1 || fx.end[3] !== 1) {
		n = 4;
	}

	// Calculate current frame for red, green, blue, and alpha
	for (i = 0; i < n; i += 1) {
		fx.now[i] = fx.start[i] + ((fx.end[i] - fx.start[i]) * fx.pos);
		// Only the red, green, and blue values must be integers
		if (i < 3) {
			fx.now[i] = round(fx.now[i]);
		}
	}
	if (fx.start[3] !== 1 || fx.end[3] !== 1) {
		// Only use RGBA if RGBA colors are given
		fx.now = 'rgba(' + fx.now.join(',') + ')';
	} else {
		// Otherwise, animate as solid colors
		fx.now.slice(0, 3);
		fx.now = 'rgb(' + fx.now.join(',') + ')';
	}
	// Animate colors for both canvas layers and DOM elements
	if (fx.elem.nodeName) {
		fx.elem.style[fx.prop] = fx.now;
	} else {
		fx.elem[fx.prop] = fx.now;
	}
}
function _animateColor(fx) {
	var n = 3,
		i;
	// Only parse start and end colors once
	if (typeOf(fx.start) !== 'array') {
		fx.start = _colorToRgbArray(fx.start);
		fx.end = _colorToRgbArray(fx.end);
	}
	fx.now = [];

	// If colors are RGBA, animate transparency
	if (fx.start[3] !== 1 || fx.end[3] !== 1) {
		n = 4;
	}

	// Calculate current frame for red, green, blue, and alpha
	for (i = 0; i < n; i += 1) {
		fx.now[i] = fx.start[i] + ((fx.end[i] - fx.start[i]) * fx.pos);
		// Only the red, green, and blue values must be integers
		if (i < 3) {
			fx.now[i] = round(fx.now[i]);
		}
	}
	if (fx.start[3] !== 1 || fx.end[3] !== 1) {
		// Only use RGBA if RGBA colors are given
		fx.now = 'rgba(' + fx.now.join(',') + ')';
	} else {
		// Otherwise, animate as solid colors
		fx.now.slice(0, 3);
		fx.now = 'rgb(' + fx.now.join(',') + ')';
	}
	// Animate colors for both canvas layers and DOM elements
	if (fx.elem.nodeName) {
		fx.elem.style[fx.prop] = fx.now;
	} else {
		fx.elem[fx.prop] = fx.now;
	}
}
function _animateColor ( fx ) { var n = 3 , i ; // Only parse start and end colors once if ( typeOf ( fx . start ) !== 'array' ) { fx . start = _colorToRgbArray ( fx . start ) ; fx . end = _colorToRgbArray ( fx . end ) ; } fx . now = [ ] ; // If colors are RGBA, animate transparency if ( fx . start [ 3 ] !== 1 || fx . end [ 3 ] !== 1 ) { n = 4 ; } // Calculate current frame for red, green, blue, and alpha for ( i = 0 ; i < n ; i += 1 ) { fx . now [ i ] = fx . start [ i ] + ( ( fx . end [ i ] - fx . start [ i ] ) * fx . pos ) ; // Only the red, green, and blue values must be integers if ( i < 3 ) { fx . now [ i ] = round ( fx . now [ i ] ) ; } } if ( fx . start [ 3 ] !== 1 || fx . end [ 3 ] !== 1 ) { // Only use RGBA if RGBA colors are given fx . now = 'rgba(' + fx . now . join ( ',' ) + ')' ; } else { // Otherwise, animate as solid colors fx . now . slice ( 0 , 3 ) ; fx . now = 'rgb(' + fx . now . join ( ',' ) + ')' ; } // Animate colors for both canvas layers and DOM elements if ( fx . elem . nodeName ) { fx . elem . style [ fx . prop ] = fx . now ; } else { fx . elem [ fx . prop ] = fx . now ; } }
Animate a hex or RGB color
Animate a hex or RGB color