☑ Lerp the color of the material

Hello Team,

How can I lerp the color of the material from initial color to final color? I want to change the color of the solution according to amount of the other solution added…

Hi,

The first thing that jumps to mind is that colors are simply rgb values so why not simply divide the difference between the initial and final into increments. something like :

e.g. (psuodo code not tested)

var initial = new pc.Color(0.1,0.5,0.6);
var final = new pc.Color(0.9,0.2,0.2);

var intervals = 10;

for (int i=0;i<intervals;i++)
{
     var newred = ((final.r - initial.r) / intervals) * i;
     ....
     ....

}

any good for you?

Hello mrLoganite,

Yes you are right. Even we thought the same yesterday. Thanks for the help :slight_smile:

This might be of use also: