2019, use interpolator syntax and rgb ranges from 0 to 255. Good for animating any number of CSS.
//changes txt color from black to white, then white to red, then red to blue. $({'r':0,'g':0,'b':0}).animate({'r':255,'g':255,'b':255},{queue:false,duration:3000, easing:'swing', step: function(now) { nx.ui.txtSection.css('color','rgb('+this.r+','+this.g+','+this.b+')'); }, complete:function(){ $({'r':255,'g':255,'b':255}).animate({'r':255,'g':0,'b':0},{queue:false,duration:3000, easing:'swing', step: function(now) { nx.ui.txtSection.css('color','rgb('+this.r+','+this.g+','+this.b+')'); }, complete:function(){ $({'r':255,'g':0,'b':0}).animate({'r':0,'g':0,'b':255},{queue:false,duration:3000, easing:'swing', step: function(now) { nx.ui.txtSection.css('color','rgb('+this.r+','+this.g+','+this.b+')'); }, complete:function(){ } //NEXT-SUB-SEQUENCE-. }); } //NEXT-SUB-SEQUENCE-. }); } //NEXT-SUB-SEQUENCE-. }); //Here is the minimum pattern... worth learning to easily animate any css-. $({'r':0,'g':0,'b':0}).animate({'r':0,'g':255,'b':0},{queue:false,duration:3000, easing:'swing', step: function(now) { nx.ui.txtSection.css('color','rgb('+this.r+','+this.g+','+this.b+')'); }, complete:function(){ } //NEXT-SUB-SEQUENCE-. });