soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SAlphaAnimation.h
1#ifndef __SALPHAANIMATION__H__
2#define __SALPHAANIMATION__H__
3
4#include <animation/SAnimation.h>
5
6SNSBEGIN
7
8/**
9 * @class SAlphaAnimation
10 * @brief An animation that controls the alpha level of an object.
11 *
12 * Useful for fading things in and out. This animation ends up changing the alpha property of a {@link STransformation}.
13 */
14class SOUI_EXP SAlphaAnimation : public SAnimation {
15 DEF_SOBJECT(SAnimation, L"alpha")
16
17 private:
18 float mFromAlpha; ///< Starting alpha value for the animation, where 1.0 means fully opaque and 0.0 means fully transparent.
19 float mToAlpha; ///< Ending alpha value for the animation.
20
21 public:
22 /**
23 * @brief Attributes for SAlphaAnimation
24 */
25 SOUI_ATTRS_BEGIN()
26 ATTR_FLOAT(L"fromAlpha", mFromAlpha, FALSE) ///< Starting alpha value attribute.
27 ATTR_FLOAT(L"toAlpha", mToAlpha, FALSE) ///< Ending alpha value attribute.
28 SOUI_ATTRS_END()
29
30 /**
31 * @brief Default constructor
32 */
34
35 /**
36 * @brief Initializes the alpha animation with specified start and end alpha values
37 * @param fromAlpha Starting alpha value for the animation, where 1.0 means fully opaque and 0.0 means fully transparent.
38 * @param toAlpha Ending alpha value for the animation.
39 */
40 void init(float fromAlpha = 0.0f, float toAlpha = 0.0f);
41
42 protected:
43 /**
44 * @brief Changes the alpha property of the supplied {@link STransformation}
45 * @param interpolatedTime The elapsed fraction of the animation's duration.
46 * @param t Pointer to the transformation to apply the animation to.
47 */
48 STDMETHOD_(void, applyTransformation)
49 (THIS_ float interpolatedTime, ITransformation *t) OVERRIDE;
50
51 /**
52 * @brief Copies the properties of another animation to this animation
53 * @param src Pointer to the source animation to copy from.
54 */
55 STDMETHOD_(void, copy)(THIS_ const IAnimation *src) OVERRIDE;
56
57 public:
58 /**
59 * @brief Checks if the animation affects the alpha property
60 * @return TRUE if the animation affects the alpha property, FALSE otherwise.
61 * @hide
62 */
63 STDMETHOD_(BOOL, hasAlpha)(THIS) SCONST OVERRIDE;
64};
65
66SNSEND
67
68#endif // __SALPHAANIMATION__H__
void copy(const IAnimation *src)
Copies the properties of another animation to this animation.
void init(float fromAlpha=0.0f, float toAlpha=0.0f)
Initializes the alpha animation with specified start and end alpha values.
BOOL hasAlpha()
Checks if the animation affects the alpha property.
SAlphaAnimation()
Default constructor.
void applyTransformation(float interpolatedTime, ITransformation *t)
Changes the alpha property of the supplied STransformation.
SAnimation()
Default constructor for SAnimation.