max = 40;
fromR = 0;
fromG = 255;
fromB = 0;
toR = 255;
toG = 0;
toB = 0;
deltaR = Round((toR - fromR) / max);
deltaG = Round((toG - fromG) / max);
deltaB = Round((toB - fromB) / max);
R = fromR + t * deltaR;
G = fromG + t * deltaG;
B = fromB + t * deltaB;