lerpHex

lerpHex(color1, color2, amount) is a function used to caculate linear interpolation between two hexadecimal colors.
It is exclusively for Hex colors, because to calculate lerp for RGB Colors, you can simply use lerp for different components red green and blue.

Parameters

color1 Hex Color: color to start interpolation from
color2 Hex Color: color to end interpolation at
amount Number [0-1]: point of interpolation

Syntax

                
    lerpHex( color1 , color2 , amount );
    lerpHex('#695FE6','#1B1F23',0.3);        // returns #514bab
            

Example

                    
    for(i=0;i<1;i+=0.01){
        x=mapRange(i,0,1,WIDTH/4,3*WIDTH/4);
        new circle(x,HEIGHT/2,10,lerpHex('#695FE6','#ffb7ff',i),1,"#000",0);
    }