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