Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //_r, _g, and _b are the current color values
- int _max = 100; //cheer amount that will simply change the color to the specified color
- //anything less will interpolate and shift dynamically
- //values received from chat message
- cheer = 57;
- cheer_red = 230;
- cheer_green = 110;
- cheer_blue = 0;
- double interp_value = cheer >= _max ? 1.0 : cheer / _max; //calculate interpolation amount
- _r += ((cheer_red - _r) * interp_value);
- _g += ((cheer_green - _g) * interp_value);
- _b += ((cheer_blue - _b) * interp_value);
- //clamp _r, _g, and _b, and they are now the transformed color
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement