function clamp(x, y, z) -- x - cur var, y - min, z - max
if x < y then return y; end
if x > z then return z; end
return x;
end
function animate(a, b, c, d, e) -- a - is active, b - min value, c - max value, d - speed(0 - 1), e - cur var
local result = a and clamp(e + GlobalVars.frametime * (1 / d), b, c) or clamp(e - GlobalVars.frametime * (1 / d), b, c);
return result;
end
local text_alpha = 0.0
local function on_draw()
local is_active = Cheat.IsMenuVisible();
text_alpha = animate(is_active, 0.0, 1.0, 0.15, text_alpha);
--here we render using text_alpha as alpha of color
end