Lets an object fade in or out. More...
Public Member Functions | |
FadeAnimation (float inRatio, float outRatio) | |
Constructor. More... | |
template<class Animated > | |
void | operator() (Animated &animated, float progress) const |
Animates the object. More... | |
Lets an object fade in or out.
Changes the alpha value of animated objects at the beginning and/or end of the animation.
thor::FadeAnimation::FadeAnimation | ( | float | inRatio, |
float | outRatio | ||
) |
Constructor.
inRatio | The part of time during which the object is faded in. Must be in the interval [0, 1]. |
outRatio | The part of time during which the object is faded out. Must be in the interval [0, 1-inRatio]. |
Example: Let's say you want an object to fade in during the first quarter of its animation, and to fade out during the second half of its animation. Therefore, inRatio = 0.25 and outRatio = 0.5.
void thor::FadeAnimation::operator() | ( | Animated & | animated, |
float | progress | ||
) | const |
Animates the object.
animated | Object to fade in and/or out. |
progress | Value in [0,1] determining the progress of the animation. |
Animated | Type of animated object. The function thor::setAlpha() is invoked for it. |