//3 color equal ratio linear transformationintStartColor = colors[colortype][0]; intEndColor = colors[colortype][1]; intDelar = [Acolor Getred:endcolor]-[Acolor Getred:startcolor]; intDelag = [Acolor Getgreen:endcolor]-[Acolor Getgreen:startcolor]; intDelab = [Acolor Getblue:endcolor]-[Acolor Getblue:startcolor]; LONG Delatime= Sys_time-Publicvoicetimecount; floatRate = Delatime * 1.0f/(Publicvoice_time);//0-1intCurcolor = [Acolor getrgb:[acolor getred:startcolor] + delar *Rate G:[acolor Getgreen:startcolor]+ Delag *Rate B:[acolor Getblue:startcolor]+ Delab *Rate ]; Originally prepared to use this horn, but because the gradient over the smooth, the effect is not good, and later changed to 6 color flashing effect. [CPP] View plain copy//Flicker EffectintCOLORS[6] ={colors[colortype][0], colors[colortype][1], colors[colortype][2], colors[colortype][3], colors[colortype][2], colors[colortype][1]}; int_colorcount = (sys_time-publicvoicetimecount)/100;//1000/100s a changeif(_colorcount >Colorcount) {Colorcount=_colorcount; intindex = _colorcount% 6; intCurcolor = Colors[index]; }
The basic algorithm of color gradient