soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SRotateAnimation.h
1#ifndef __SRotateAnimation__H__
2#define __SRotateAnimation__H__
3
4#include <animation/SAnimation.h>
5
6SNSBEGIN
7
8/**
9 * @class SRotateAnimation
10 * @brief An animation that controls the rotation of an object. This rotation takes place in the X-Y plane.
11 *
12 * You can specify the point to use for the center of the rotation, where (0,0) is the top left point.
13 * If not specified, (0,0) is the default rotation point.
14 */
15class SOUI_EXP SRotateAnimation : public SAnimation {
16 DEF_SOBJECT(SAnimation, L"rotate")
17
18 private:
19 float mFromDegrees; ///< Rotation offset to apply at the start of the animation.
20 float mToDegrees; ///< Rotation offset to apply at the end of the animation.
21
22 SValueDescription mPivotXDesc; ///< Description of the pivot X value.
23 SValueDescription mPivotYDesc; ///< Description of the pivot Y value.
24
25 float mPivotX; ///< The X coordinate of the pivot point.
26 float mPivotY; ///< The Y coordinate of the pivot point.
27
28 public:
29 /**
30 * @brief Default constructor for SRotateAnimation.
31 * Default pivotX/pivotY point is (0,0).
32 */
34
35 /**
36 * @brief Constructor to use when building a RotateAnimation from code.
37 *
38 * @param fromDegrees Rotation offset to apply at the start of the animation.
39 * @param toDegrees Rotation offset to apply at the end of the animation.
40 * @param pivotXType Specifies how pivotXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
41 * @param pivotXValue The X coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the left edge.
42 * This value can either be an absolute number if pivotXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
43 * @param pivotYType Specifies how pivotYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
44 * @param pivotYValue The Y coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the top edge.
45 * This value can either be an absolute number if pivotYType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
46 */
47 void init(float fromDegrees, float toDegrees, const SValueDescription &pivotX, const SValueDescription &pivotY);
48
49 /**
50 * @brief Initializes the animation with the dimensions of the object and its parent.
51 * @param width Width of the object being animated.
52 * @param height Height of the object being animated.
53 * @param parentWidth Width of the parent of the object being animated.
54 * @param parentHeight Height of the parent of the object being animated.
55 * @param nScale Scale factor.
56 */
57 STDMETHOD_(void, initialize)
58 (THIS_ int width, int height, int parentWidth, int parentHeight, int nScale) OVERRIDE;
59
60 protected:
61 /**
62 * @brief Applies the transformation at a specific interpolated time.
63 * @param interpolatedTime Interpolated time between 0 and 1.
64 * @param t Pointer to the transformation to apply.
65 */
66 STDMETHOD_(void, applyTransformation)
67 (THIS_ float interpolatedTime, ITransformation *t) OVERRIDE;
68
69 /**
70 * @brief Copies the properties of another animation to this animation.
71 * @param src Pointer to the source animation to copy from.
72 */
73 STDMETHOD_(void, copy)(THIS_ const IAnimation *src) OVERRIDE;
74
75 public:
76 /**
77 * @brief Attributes for SRotateAnimation
78 */
79 SOUI_ATTRS_BEGIN()
80 ATTR_FLOAT(L"fromDegrees", mFromDegrees, FALSE) ///< Rotation offset to apply at the start of the animation.
81 ATTR_FLOAT(L"toDegrees", mToDegrees, FALSE) ///< Rotation offset to apply at the end of the animation.
82 ATTR_VALUE_DESC(L"pivotX", mPivotXDesc) ///< Description of the pivot X value.
83 ATTR_VALUE_DESC(L"pivotY", mPivotYDesc) ///< Description of the pivot Y value.
84 SOUI_ATTRS_END()
85};
86
87SNSEND
88
89#endif // __SRotateAnimation__H__
SAnimation()
Default constructor for SAnimation.
void applyTransformation(float interpolatedTime, ITransformation *t) OVERRIDE
Applies the transformation at a specific interpolated time.
void init(float fromDegrees, float toDegrees, const SValueDescription &pivotX, const SValueDescription &pivotY)
Constructor to use when building a RotateAnimation from code.
void copy(const IAnimation *src) OVERRIDE
Copies the properties of another animation to this animation.
void initialize(int width, int height, int parentWidth, int parentHeight, int nScale) OVERRIDE
Initializes the animation with the dimensions of the object and its parent.
SRotateAnimation()
Default constructor for SRotateAnimation. Default pivotX/pivotY point is (0,0).
Utility class to parse a string description of a size.
Definition SAnimation.h:24