2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiAnimAnimationBase.h
20 * @brief This is the header file for the %AnimationBase class.
22 * This header file contains the declarations of the %AnimationBase class and the enumerators related to it.
25 #ifndef _FUI_ANIM_ANIMATION_BASE_H_
26 #define _FUI_ANIM_ANIMATION_BASE_H_
28 #include <FBaseTypes.h>
29 #include <FBaseString.h>
30 #include <FUiAnimTypes.h>
32 namespace Tizen { namespace Ui { namespace Animations
36 * @class AnimationBase
37 * @brief This class is the base class for all the Animation classes. @n
38 * It is an abstract base class.
42 * The %AnimationBase class defines the basic animation properties, such as the interpolator to be used, the duration of the animation in milliseconds, the delay before the animation is started in milliseconds, and the repeat count.
45 class _OSP_EXPORT_ AnimationBase
46 : public Tizen::Base::Object
51 * This is the destructor for this class.
55 virtual ~AnimationBase(void);
59 * Sets the duration of the animation.
63 * @return An error code
64 * @param[in] milliseconds The duration of the animation in milliseconds
65 * @exception E_SUCCESS The method is successful.
66 * @exception E_INVALID_ARG The value of the specified parameter is negative.
68 result SetDuration(long milliseconds);
72 * Sets the offset value of the animation. @n
73 * Additionally, the %SetOffset() method alters the start value and duration for which an animation is played.
77 * @return An error code
78 * @param[in] milliseconds The offset of the animation in milliseconds
79 * @exception E_SUCCESS The method is successful.
80 * @exception E_INVALID_ARG The value of the specified parameter is negative or greater than the duration of the animation.
81 * @remarks If the start value of the animation is @c 0.0, the end value is @c 1.0, the duration is @c 100 ms and the offset value is @c 20 ms,
82 * the actual animation starts at @c 0th ms and plays for @c 80 ms with a start value of @c 0.2. @n
83 * If @c autoReverseset is set to @c true, the Backward animation plays for 100ms, from @c 1.0 to @c 0.0.
85 result SetOffset(long milliseconds);
89 * Sets the delay for the animation. @n
90 * The animation starts after the duration of delay has passed.
94 * @return An error code
95 * @param[in] milliseconds The delay for the animation to start in milliseconds
96 * @exception E_SUCCESS The method is successful.
97 * @exception E_INVALID_ARG The value of the specified parameter is negative.
98 * @remarks This method does not alter the start, end, and duration values of the animation.
100 result SetDelay(long milliseconds);
104 * Sets the repeat count for the animation. @n
105 * Repeats an animation for the specified number of times.
109 * @return An error code
110 * @param[in] count The number of times the animation has to repeat
111 * @exception E_SUCCESS The method is successful.
112 * @exception E_INVALID_ARG The value of the specified parameter is negative.
113 * @remarks A delay and offset is applied to an animation only when the animation is played for the first time.
115 result SetRepeatCount(long count);
119 * Sets the AutoReverse property of the animation. @n
120 * If enabled, the forward and backward animation can also be played.
124 * @param[in] autoReverse Set to @c true to enable the AutoReverse property of the animation, @n
126 * @remarks If @c autoReverseset is set to @c true, the duration of the animation is doubled.
127 * If the repeat count is more than 1, @n
128 * @c autoReverse is applied to each iteration.
129 * Note that if @c autoReverse is set to @c true, one forward animation play and one backward animation play is one
132 void SetAutoReverseEnabled(bool autoReverse);
136 * Sets the scale ratio of the animation. @n
137 * The %SetScaleRatio() method multiplies the duration, offset, and delay using the scale ratio.
141 * @return An error code
142 * @param[in] scaleRatio The scale ratio property of the animation
143 * @exception E_SUCCESS The method is successful.
144 * @exception E_INVALID_ARG The value of the specified parameter is negative.
146 result SetScaleRatio(float scaleRatio);
150 * Sets the hold end value of the animation. @n
151 * The %SetHoldEndEnabled() method retains the end values of an animation or goes to the start value of an animation.
155 * @param[in] holdEnd Set to @c true to hold the end values of the animation, @n
158 void SetHoldEndEnabled(bool holdEnd);
162 * Gets the duration of the animation in milliseconds.
166 * @return The duration value of the animation
168 long GetDuration(void) const;
172 * Gets the offset value in milliseconds after the animation starts.
176 * @return The offset value of the animation in milliseconds @n
177 * The default value of the offset is @c 0.
179 long GetOffset(void) const;
183 * Gets the delay value in milliseconds before the animation starts.
187 * @return The delay value in milliseconds @n
188 * The default value of the delay is @c 0.
190 long GetDelay(void) const;
194 * Gets the repeat count value of the animation.
198 * @return The repeat count value of the animation @n
199 * The default value of the repeat count is @c 1.
201 long GetRepeatCount(void) const;
205 * Checks whether the auto reverse is enabled.
209 * @return @c true if the auto reverse is enabled, @n
211 * The default auto reverse value is @c false.
213 bool IsAutoReverseEnabled(void) const;
217 * Gets the scale ratio value of the animation.
221 * @return The scale ratio value of the animation @n
222 * The default value of scale ratio is @c 1.0f.
224 float GetScaleRatio(void) const;
228 * Checks whether the hold end value of the animation is enabled.
232 * @return @c true if the hold end value is enabled, @n
234 * The default hold end value is @c true.
236 bool IsHoldEndEnabled(void) const;
240 * Sets the interpolator type.
244 * @param[in] interpolatorType The interpolator type used for the animation
246 void SetInterpolatorType(AnimationInterpolatorType interpolatorType);
250 * Gets the interpolator type.
254 * @return The interpolator type of an animation @n
255 * The default interpolator type is @c ANIMATION_INTERPOLATOR_LINEAR.
257 AnimationInterpolatorType GetInterpolatorType(void) const;
261 * Sets the control points for Bezier interpolator. @n
262 * The %SetBezierControlPoints() method is supported only if the interpolator is ANIMATION_INTERPOLATOR_BEZIER.
266 * @return An error code
267 * @param[in] time1 The control point 1 - Time @n
268 * The time must be in the range @c 0.0 to @c 1.0. The time value is scaled relative to the duration of the animation.
269 * @param[in] value1 The control point 1 - Value @n
270 * The value must be in the range @c 0.0 to @c 1.0. The value is scaled relative to the start and end value of the animation.
271 * @param[in] time2 The control point 2 - Time @n
272 * The time must be in the range @c 0.0 to @c 1.0. The time value is scaled relative to the duration of the animation.
273 * @param[in] value2 The control point 2 - Value @n
274 * The value must be in the range @c 0.0 to @c 1.0. The value is scaled relative to the start and end value of the animation.
275 * @exception E_SUCCESS The method is successful.
276 * @exception E_INVALID_OPERATION This method is not supported for the interpolator set of this instance.
277 * @exception E_INVALID_ARG A specified input parameter is invalid.
278 * @remarks @c time1 can be greater than @c time2 and vice versa.
280 result SetBezierControlPoints(float time1, float value1, float time2, float value2);
284 * Gets the control points of the Bezier interpolator. @n
285 * The %GetBezierControlPoints() method is supported only if the interpolator is @c ANIMATION_INTERPOLATOR_BEZIER. @c 0 is returned for the other interpolators.
289 * @return An error code
290 * @param[out] time1 The control point 1 - Time @n
291 * The default value of control point 1 is @c 0.0.
292 * @param[out] value1 The control point 1 - Value @n
293 * The default value of control point 1 is @c 0.0.
294 * @param[out] time2 The control point 2 - Time @n
295 * The default value of control point 2 is @c 0.0.
296 * @param[out] value2 The control point 2 - Value @n
297 * The default value of control point 2 is @c 0.0.
298 * @exception E_SUCCESS The method is successful.
299 * @exception E_INVALID_OPERATION This method is not supported for the interpolator set of this instance.
302 result GetBezierControlPoints(float& time1, float& value1, float& time2, float& value2) const;
306 * Gets the count of key frames added to this animation.
310 * @return The key frame count
312 int GetKeyFrameCount(void) const;
316 * Sets the name of the animation.
320 * @param[in] name The name of the animation
322 void SetName(const Tizen::Base::String& name);
326 * Gets the name of the animation.
330 * @return The name of the animation @n
331 * The default value of the name is an empty string.
333 Tizen::Base::String GetName(void) const;
337 * Gets the type information of this instance.
341 * @return The type information of this instance
343 virtual AnimationType GetType(void) const = 0;
349 // This method is for internal use only. Using this method can cause behavioral, security-related,
350 // and consistency-related issues in the application.
352 // This is the default constructor for this class.
360 // This method is for internal use only. Using this method can cause behavioral, security-related,
361 // and consistency-related issues in the application.
363 // This is the copy constructor for the %AnimationBase class.
367 // @param[in] animationBase An instance of AnimationBase
368 // @remarks The animation name of the copied %AnimationBase object will be same as the %AnimationBase object passed.
369 // User must change the name using the SetName() method of this class in order to make animation name unique.
371 AnimationBase(const AnimationBase& animationBase);
375 // This method is for internal use only. Using this method can cause behavioral, security-related,
376 // and consistency-related issues in the application.
378 // This is the constructor for this class.
382 // @param[in] duration The duration of animation in milliseconds
383 // @param[in] interpolator The type of Interpolation used for animation's intermediate value calculation
385 AnimationBase(long duration, AnimationInterpolatorType interpolator);
389 // This method is for internal use only. Using this method can cause behavioral, security-related,
390 // and consistency-related issues in the application.
392 // Assigns the value of the specified instance to the current instance of %AnimationBase.
396 // @param[in] value An instance of %AnimationBase
397 // @remarks The animation name of the returned %AnimationBase object will be same as the %AnimationBase object passed.
398 // User must change the name using SetName() method of this class in order to make animation name unique.
400 AnimationBase& operator =(const AnimationBase& value);
404 // This method is for internal use only. Using this method can cause behavioral, security-related,
405 // and consistency-related issues in the application.
407 // This method is reserved and may change its name at any time without
412 virtual void AnimationBase_Reserved1(void);
416 // This method is for internal use only. Using this method can cause behavioral, security-related,
417 // and consistency-related issues in the application.
419 // This method is reserved and may change its name at any time without
424 virtual void AnimationBase_Reserved2(void);
428 // This method is for internal use only. Using this method can cause behavioral, security-related,
429 // and consistency-related issues in the application.
431 // This method is reserved and may change its name at any time without
436 virtual void AnimationBase_Reserved3(void);
439 friend class _AnimationBaseImpl;
443 // This variable is for internal use only. Using this variable can cause behavioral, security-related,
444 // and consistency-related issues in the application.
446 // This variable is for internal usage.
450 class _AnimationBaseImpl* _pAnimationBaseImpl;
454 }}} // Tizen::Ui::Animations
456 #endif // _FUI_ANIM_ANIMATION_BASE_H_