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 FUiAnimFloatAnimation.h
20 * @brief This is the header file for the %FloatAnimation class.
22 * This header file contains the declaration of the %FloatAnimation class.
25 #ifndef _FUI_ANIM_FLOAT_ANIMATION_H_
26 #define _FUI_ANIM_FLOAT_ANIMATION_H_
28 #include <FBaseFloat.h>
29 #include <FUiAnimAnimationBase.h>
31 namespace Tizen { namespace Ui { namespace Animations
35 * @class FloatAnimation
36 * @brief This class animates an object from a float value to another float value.
40 * @final This class is not intended for extension.
42 * The %FloatAnimation class animates an object from a float value to another float value based on the specified interpolator type.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/animating_uicontrols.htm">Animating UI Controls</a>.
47 class _OSP_EXPORT_ FloatAnimation
48 : public AnimationBase
52 * Initializes this instance of %FloatAnimation with the specified parameters.
56 * @param[in] startValue The start value for float animation
57 * @param[in] endValue The end value for float animation
58 * @param[in] duration The duration of animation in milliseconds
59 * @param[in] interpolator The type of interpolation used for the intermediate value calculation of the animation
60 * @exception E_SUCCESS The method is successful.
61 * @exception E_INVALID_ARG The value of the specified parameter is negative or the interpolator is of an invalid type.
62 * @remarks The specific error code can be accessed using the GetLastResult() method.
64 FloatAnimation(float startValue, float endValue, long duration, AnimationInterpolatorType interpolator);
68 * This is the destructor for this class.
72 virtual ~FloatAnimation(void);
76 * Assigns the value of the specified instance to the current instance of %FloatAnimation.
80 * @param[in] floatAnimation An instance of %FloatAnimation
81 * @exception E_SUCCESS The method is successful.
82 * @exception E_OUT_OF_MEMORY The memory is insufficient.
83 * @remarks The specific error code can be accessed using the GetLastResult() method.
85 FloatAnimation(const FloatAnimation& floatAnimation);
89 * Assigns the value of the specified instance to the current instance of %FloatAnimation.
93 * @param[in] rhs An instance of %FloatAnimation
94 * @exception E_SUCCESS The method is successful.
95 * @exception E_OUT_OF_MEMORY The memory is insufficient.
96 * @remarks The specific error code can be accessed using the GetLastResult() method.
98 FloatAnimation& operator =(const FloatAnimation& rhs);
102 * Checks whether the specified instance and current instance of %FloatAnimation have equal animation values.
106 * @return @c true if the animation of the two instances of %FloatAnimation are equal, @n
108 * @param[in] rhs An instance of %FloatAnimation
110 bool operator ==(const FloatAnimation& rhs) const;
114 * Checks whether the specified instance and current instance of %FloatAnimation have different animation values.
118 * @return @c true if the values of the animations of the two instances of %FloatAnimation are not equal, @n
120 * @param[in] rhs An instance of %FloatAnimation
122 bool operator !=(const FloatAnimation& rhs) const;
126 * Checks whether the value of the current instance of %FloatAnimation equals the value of the specified instance.
130 * @return @c true if the value of the current instance equals the value of the specified instance, @n
132 * @param[in] obj An instance of %FloatAnimation
133 * @remarks The %FloatAnimation class has a semantic value. @n
134 * This means that this method checks whether the two instances have the same animation.
136 virtual bool Equals(const Tizen::Base::Object& obj) const;
140 * Gets the hash value of the current instance.
144 * @return The hash value of the current instance
145 * @remarks The two equal instances must return the same hash value. For better performance, the used hash function must generate a random distribution
148 virtual int GetHashCode(void) const;
152 * Gets the animated value for the current time.
156 * @return An error code
157 * @param[in] currentTime The current time value of the animation play @n
158 * The value must be between @c 0 and the duration of the animation.
159 * @param[out] animatedValue The animated value for the @c currentTime passed as input
160 * @exception E_SUCCESS The method is successful.
161 * @exception E_INVALID_ARG A specified input parameter is invalid.
162 * @exception E_SYSTEM A system error has occurred.
164 result GetAnimatedValue(long currentTime, float& animatedValue) const;
168 * Adds a key frame to the animation.
172 * @return An error code
173 * @param[in] time The time stamp
174 * @param[in] value The value at the specified @c time
175 * @exception E_SUCCESS The method is successful.
176 * @exception E_INVALID_ARG A specified input parameter is invalid.
177 * @exception E_SYSTEM A system error has occurred.
178 * @remarks If @c time is greater than the duration, it becomes the new @c duration and value becomes the new @c endValue.
179 * Also the old @c duration and @c endValue are added as a new key frame entry in the list.
180 * @remarks If a key-value pair with the current key already exists, the old value is overwritten with the new value.
181 * @remarks An exception is returned if the @c time is equal to @c 0 or the duration of the animation.
183 result AddKeyFrame(long time, float value);
187 * Gets the keyframe at a particular index in this animation.
191 * @return An error code
192 * @param[in] index The index value in the Keyframe list @n
193 * This value is sorted in an increasing order of time.
194 * @param[out] time The time stamp at the specified @c index
195 * @param[out] value The value at the specified @c index
196 * @exception E_SUCCESS The method is successful.
197 * @exception E_OUT_OF_RANGE The specified index is out of range.
198 * @exception E_SYSTEM A system error has occurred.
199 * @remarks The @c time and @c value returned, are the one present at the index of the sorted map list (sorted with respect to key).
200 * For example, if the user adds keyframe in the order (10,value1), (20,value2), (5,value3), and
201 * the GetKeyFrameAt (0,time,value) is called, the pair returned is (5,value3).
203 result GetKeyFrameAt(int index, long& time, float& value) const;
207 * Removes the passed keyframe object from the keyframe list.
211 * @return An error code
212 * @param[in] time The key frame time
213 * @exception E_SUCCESS The method is successful.
214 * @exception E_INVALID_ARG The specified @c time is invalid.
215 * @exception E_OBJ_NOT_FOUND The specified @c time is not found in the KeyFrame List.
216 * @exception E_SYSTEM A system error has occurred.
218 result RemoveKeyFrame(long time);
222 * Removes the keyframe present at the specified @c index from the keyframe list.
226 * @return An error code
227 * @param[in] index The index value in the Keyframe list @n
228 * This value is sorted in an increasing order of time.
229 * @exception E_SUCCESS The method is successful.
230 * @exception E_OUT_OF_RANGE The specified @c index is out of range.
231 * @exception E_SYSTEM A system error has occurred.
233 result RemoveKeyFrameAt(int index);
237 * Removes all the keyframes from the animation.
241 * @return An error code
242 * @exception E_SUCCESS The method is successful.
243 * @exception E_SYSTEM A system error has occurred.
245 result RemoveAllKeyFrames(void);
249 * Sets the start value of the animation.
253 * @return An error code
254 * @param[in] startValue The start value of the animation to set
255 * @exception E_SUCCESS The method is successful.
256 * @exception E_SYSTEM A system error has occurred.
258 result SetStartValue(float startValue);
262 * Sets the end value of the animation.
266 * @return An error code
267 * @param[in] endValue The end value of the animation to set
268 * @exception E_SUCCESS The method is successful.
269 * @exception E_SYSTEM A system error has occurred.
271 result SetEndValue(float endValue);
275 * Gets the start value of the animation.
279 * @return The start value
281 float GetStartValue(void) const;
285 * Gets the end value of the animation.
289 * @return The end value
291 float GetEndValue(void) const;
295 * Gets the type information of this instance.
299 * @return The type information of this instance
301 virtual AnimationType GetType(void) const;
306 // This method is for internal use only. Using this method can cause behavioral, security-related,
307 // and consistency-related issues in the application.
309 // This is the default constructor for this class.
313 FloatAnimation(void);
316 friend class _FloatAnimationImpl;
320 // This method is for internal use only. Using this method can cause behavioral, security-related,
321 // and consistency-related issues in the application.
323 // The variable for internal usage.
327 class _FloatAnimationImpl* _pFloatAnimationImpl;
331 }}} // Tizen::Ui::Animations
333 #endif // _FUI_ANIM_FLOAT_ANIMATION_H_