Fade any colour to white
#2

pawn Код:
FadeToWhite(colour, Float:percent)
{
    if (percent <= 0.0) {
        return colour;
    }

    if (percent >= 1.0) {
        return 0xFFFFFF;
    }

    new
        r = (colour >> 16) & 0xFF,
        g = (colour >> 8) & 0xFF,
        b = colour & 0xFF,
        dr = floatround((0xFF - r) * percent),
        dg = floatround((0xFF - g) * percent),
        db = floatround((0xFF - b) * percent)
    ;

    return ((r + dr) << 16) + ((g + dg) << 8) + (b + db);
}
Good enough
Reply


Messages In This Thread
Fade any colour to white - by Misiur - 28.09.2017, 00:32
Re: Fade any colour to white - by Misiur - 28.09.2017, 00:54
Re: Fade any colour to white - by Sew_Sumi - 28.09.2017, 06:19
Re: Fade any colour to white - by Misiur - 28.09.2017, 07:34

Forum Jump:


Users browsing this thread: 1 Guest(s)