- Status
- Offline
- Joined
- Jul 11, 2019
- Messages
- 5
- Reaction score
- 6
When a player becomes invalid, the box fades out smoothly.
Not very useful function, but it looks nice
Not very useful function, but it looks nice
Code:
// Expression
float Interp(float s1, float s2, float s3, float f1, float f3)
{
if (s2 == s1)
return f1;
if (s2 == s3)
return f3;
if (s3 == s1)
return f1;
return f1 + ((s2 - s1) / (s3 - s1)) * (f3 - f1);
}
// Where is the Player box
static DWORD smooth_time = 0;
// alpha
box_color[3] = Interp((float)smooth_time, (float)GetTickCount(), (float)smooth_time + 300.f, box_color[3] 0);
// imgui
//box_color.Value.w = Interp((float)smooth_time, (float)GetTickCount(), (float)smooth_time + 300.f, box_color.Value.w, 0);