Skip to content
Permalink
Browse files

Effects core: Tweaked color animation.

  • Loading branch information...
scottgonzalez committed Jun 15, 2009
1 parent 58b37be commit 2f161c13dee5d2269307e563d4ba43e7c196364f
Showing with 8 additions and 9 deletions.
  1. +8 −9 ui/effects.core.js
@@ -241,18 +241,17 @@ $.fn.extend({
// override the animation for color styles
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],
function(i,attr){
function(i, attr) {
$.fx.step[attr] = function(fx) {
if (fx.state == 0) {
fx.start = getColor( fx.elem, attr );
fx.end = getRGB( fx.end );
if (fx.state === 0) {
fx.start = getColor(fx.elem, attr);
fx.end = getRGB(fx.end);
}

fx.elem.style[attr] = "rgb(" + [
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0)
].join(",") + ")";
fx.elem.style[attr] = 'rgb(' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
};
});

0 comments on commit 2f161c1

Please sign in to comment.
You can’t perform that action at this time.