Skip to content

Instantly share code, notes, and snippets.

@jpleau
Created June 24, 2013 00:24
Show Gist options
  • Save jpleau/5847049 to your computer and use it in GitHub Desktop.
Save jpleau/5847049 to your computer and use it in GitHub Desktop.
sf::Vector3f x(start_color.r, start_color.g, start_color.b);
sf::Vector3f y(end_color.r, end_color.g, end_color.b);
const float max_time = fade_duration; // == 1.0f
const float current_time = fade_timer.restart().asSeconds();
const float a = std::min(1.0f, std::max(0.0f, current_time - max_time));
sf::Vector3f interp = x * (1 - a) + y * a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment