Class to implement color gradients. More...
Public Member Functions | |
ColorGradient (const sf::Color &color) | |
Implicit constructor from single color. | |
sf::Color | GetColor (float interpolation) const |
Returns the color at a given progress of the gradient. | |
Related Functions | |
ColorGradientConvertible | thor::CreateGradient (const sf::Color &color) |
Creates a color gradient based on a list of colors and transitions. |
Class to implement color gradients.
This class can represent color gradients and calculate the color at a given point. A color gradient consists of a list of N different colors and N-1 corresponding transition times (which specify how long it takes to morph one color to the other).
thor::ColorGradient::ColorGradient | ( | const sf::Color & | color | ) |
Implicit constructor from single color.
Creates a gradient that contains only a single color.
sf::Color thor::ColorGradient::GetColor | ( | float | interpolation | ) | const |
Returns the color at a given progress of the gradient.
interpolation | Number in [0.f, 1.f] that stands for the point at which you want to access a color from the gradient. When you pass 0 (1), the color at the very beginning (end) is returned. If the gradient consists of a single color, it is always returned (independently of interpolation). |