mardi 2 juillet 2019

Set alpha color value from distance

Im trying to set the alpha to fade away from the distance between smallest and largest value At the moment i only have it working with largest value so 0 to largest But i want it to fade from smallest incase it is bigger then 0.

int smallest = 0; // theses are set elsewhere
int largest = 0;

if (distance < largest)
{
    int iAlphaFade = 255 - distance / largest * 255;

    DWORD color = ARGB(iAlphaFade, 255, 255, 255);
    if (Obj == localObj)
        color = ARGB(iAlphaFade, 0, 255, 0);
    else
        color = ARGB(iAlphaFade, 255, 0, 0);
}

Aucun commentaire:

Enregistrer un commentaire