Merge "Updated test harness code to enable styling through links." into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / animation / animation.h
1 #ifndef __DALI_ANIMATION_H__
2 #define __DALI_ANIMATION_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <boost/function.hpp>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/animation/alpha-functions.h>
26 #include <dali/public-api/animation/key-frames.h>
27 #include <dali/public-api/animation/time-period.h>
28 #include <dali/public-api/object/any.h>
29 #include <dali/public-api/object/handle.h>
30 #include <dali/public-api/object/property.h>
31 #include <dali/public-api/signals/dali-signal-v2.h>
32
33 namespace Dali
34 {
35
36 class Actor;
37 struct Degree;
38 class Quaternion;
39 struct Radian;
40 class ShaderEffect;
41 struct Property;
42 struct Vector2;
43 struct Vector3;
44 struct Vector4;
45
46 typedef boost::function<bool       (float alpha, const bool& current)>       AnimatorFunctionBool;      ///< Animator function signature for boolean properties.
47 typedef boost::function<float      (float alpha, const float& current)>      AnimatorFunctionFloat;     ///< Animator function signature for float properties.
48 typedef boost::function<int        (float alpha, const int& current)>        AnimatorFunctionInteger;   ///< Animator function signature for integer properties.
49 typedef boost::function<Vector2    (float alpha, const Vector2& current)>    AnimatorFunctionVector2;   ///< Animator function signature for Vector2 properties.
50 typedef boost::function<Vector3    (float alpha, const Vector3& current)>    AnimatorFunctionVector3;   ///< Animator function signature for Vector3 properties.
51 typedef boost::function<Vector4    (float alpha, const Vector4& current)>    AnimatorFunctionVector4;   ///< Animator function signature for Vector4 properties.
52 typedef boost::function<Quaternion (float alpha, const Quaternion& current)> AnimatorFunctionQuaternion;///< Animator function signature for Quaternion properties.
53
54 namespace Internal DALI_INTERNAL
55 {
56 class Animation;
57 }
58
59 /**
60  * @brief Dali::Animation can be used to animate the properties of any number of objects, typically Actors.
61  *
62  * An example animation setup is shown below:
63  *
64  * @code
65  *
66  * struct MyProgram
67  * {
68  *   Actor mActor; // The object we wish to animate
69  *   Animation mAnimation; // Keep this to control the animation
70  * }
71  *
72  * // ...To play the animation
73  *
74  * mAnimation = Animation::New(3.0f); // duration 3 seconds
75  * mAnimation.MoveTo(mActor, 10.0f, 50.0f, 0.0f);
76  * mAnimation.Play();
77  *
78  * @endcode
79  *
80  * Dali::Animation supports "fire and forget" behaviour i.e. an animation continues to play if the handle is discarded.
81  * Note that in the following example, the "Finish" signal will be emitted:
82  *
83  * @code
84  *
85  * void ExampleCallback( Animation& source )
86  * {
87  *   std::cout << "Animation has finished" << std::endl;
88  * }
89  *
90  * void ExampleAnimation( Actor actor )
91  * {
92  *   Animation animation = Animation::New(2.0f); // duration 2 seconds
93  *   animation.MoveTo(actor, 10.0f, 50.0f, 0.0f);
94  *   animation.FinishedSignal().Connect( ExampleCallback );
95  *   animation.Play();
96  * } // At this point the animation handle has gone out of scope
97  *
98  * Actor actor = Actor::New();
99  * Stage::GetCurrent().Add( actor );
100  *
101  * // Fire animation and forget about it
102  * ExampleAnimation( actor );
103  *
104  * // However the animation will continue, and "Animation has finished" will be printed after 2 seconds.
105  *
106  * @endcode
107  *
108  * If the "Finish" signal is connected to a member function of an object, it must be disconnected before the object is destroyed.
109  * This is typically done in the object destructor, and requires either the Dali::Connection object or Dali::Animation handle to be stored.
110  */
111 class DALI_IMPORT_API Animation : public BaseHandle
112 {
113 public:
114
115   typedef SignalV2< void (Animation&) > AnimationSignalV2; ///< Animation finished signal type
116
117   typedef Any AnyFunction; ///< Interpolation function
118   typedef boost::function<Vector3 (float alpha, const Vector3& current)> Vector3AnimatorFunc; ///< Interpolation function
119   typedef boost::function<Quaternion (float alpha, const Quaternion& current)> QuaternionAnimatorFunc; ///< Interpolation function
120
121   /**
122    * @brief What to do when the animation ends, is stopped or is destroyed
123    */
124   enum EndAction
125   {
126     Bake,     ///< When the animation ends, the animated property values are saved.
127     Discard,  ///< When the animation ends, the animated property values are forgotten.
128     BakeFinal ///< If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Bake.
129   };
130
131   //Signal Names
132   static const char* const SIGNAL_FINISHED; ///< name "finished"
133
134   //Action Names
135   static const char* const ACTION_PLAY;     ///< name "play"
136   static const char* const ACTION_STOP;     ///< name "stop"
137   static const char* const ACTION_PAUSE;    ///< name "pause"
138
139   /**
140    * @brief Create an uninitialized Animation; this can be initialized with Animation::New().
141    *
142    * Calling member functions with an uninitialized Dali::Object is not allowed.
143    */
144   Animation();
145
146   /**
147    * @brief Create an initialized Animation.
148    *
149    * The animation will not loop.
150    * The default end action is "Bake".
151    * The default alpha function is linear.
152    * @pre durationSeconds must be greater than zero.
153    * @param [in] durationSeconds The duration in seconds.
154    * @return A handle to a newly allocated Dali resource.
155    */
156   static Animation New(float durationSeconds);
157
158   /**
159    * @brief Downcast an Object handle to Animation.
160    *
161    * If handle points to an Animation object the downcast produces
162    * valid handle. If not the returned handle is left uninitialized.
163    *
164    * @param[in] handle to An object
165    * @return handle to a Animation object or an uninitialized handle
166    */
167   static Animation DownCast( BaseHandle handle );
168
169   /**
170    * @brief Destructor
171    *
172    * This is non-virtual since derived Handle types must not contain data or virtual methods.
173    */
174   ~Animation();
175
176   /**
177    * @brief This copy constructor is required for (smart) pointer semantics.
178    *
179    * @param [in] handle A reference to the copied handle
180    */
181   Animation(const Animation& handle);
182
183   /**
184    * @brief This assignment operator is required for (smart) pointer semantics.
185    *
186    * @param [in] rhs  A reference to the copied handle
187    * @return A reference to this
188    */
189   Animation& operator=(const Animation& rhs);
190
191   /**
192    * @brief Set the duration of an animation.
193    *
194    * @pre durationSeconds must be greater than zero.
195    * @param[in] seconds The duration in seconds.
196    */
197   void SetDuration(float seconds);
198
199   /**
200    * @brief Retrieve the duration of an animation.
201    *
202    * @return The duration in seconds.
203    */
204   float GetDuration() const;
205
206   /**
207    * @brief Set whether the animation will loop.
208    *
209    * @param[in] looping True if the animation will loop.
210    */
211   void SetLooping(bool looping);
212
213   /**
214    * @brief Query whether the animation will loop.
215    *
216    * @return True if the animation will loop.
217    */
218   bool IsLooping() const;
219
220   /**
221    * @brief Set the end action of the animation.
222    *
223    * This action is performed when the animation ends or if it is stopped.
224    * Default end action is bake
225    * @param[in] action The end action.
226    */
227   void SetEndAction(EndAction action);
228
229   /**
230    * @brief Returns the end action of the animation.
231    *
232    * @return The end action.
233    */
234   EndAction GetEndAction() const;
235
236   /**
237    * @brief Set the disconnect action.
238    *
239    * If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.
240    * Default action is to BakeFinal.
241    * @param[in] disconnectAction The disconnect action.
242    */
243   void SetDisconnectAction( EndAction disconnectAction );
244
245   /**
246    * @brief Returns the disconnect action.
247    *
248    * @return The disconnect action.
249    */
250   EndAction GetDisconnectAction() const;
251
252   /**
253    * @brief Set the default alpha function for an animation.
254    *
255    * This is applied to individual property animations, if no further alpha functions are supplied.
256    * @param[in] alpha The default alpha function.
257    */
258   void SetDefaultAlphaFunction(AlphaFunction alpha);
259
260   /**
261    * @brief Retrieve the default alpha function for an animation.
262    *
263    * @return The default alpha function.
264    */
265   AlphaFunction GetDefaultAlphaFunction() const;
266
267   /*
268    * @brief Sets the progress of the animation.
269    * The animation will play (or continue playing) from this point. The progress
270    * must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
271    * otherwise, it will be ignored.
272    *
273    * @param[in] progress The new progress as a normalized value between [0,1] or between the
274    * play range if specified.
275    */
276   void SetCurrentProgress( float progress );
277
278   /**
279   * @brief Retrieve the current progress of the animation.
280   *
281   * @return The current progress as a normalized value between [0,1].
282   */
283   float GetCurrentProgress();
284
285   /**
286    * @brief Specifies an speed factor for the animation.
287    *
288    * The speed factor is a multiplier of the normal velocity of the animation. Values between [0,1] will
289    * slow down the animation and values above one will speed up the animation. It is also possible to specify a negative multiplier
290    * to play the animation in reverse.
291    *
292    * @param[in] factor A value which will multiply the velocity.
293    */
294   void SetSpeedFactor( float factor );
295
296   /**
297    * @brief Retrieve the speed factor of the animation
298    *
299    * @return speed factor
300    */
301   float GetSpeedFactor() const;
302
303   /**
304    * @brief Set the playing range.
305    * Animation will play between the values specified. Both values ( range.x and range.y ) should be between 0-1,
306    * otherwise they will be ignored. If the range provided is not in proper order ( minimum,maximum ), it will be reordered.
307    *
308    * @param[in] range Two values between [0,1] to specify minimum and maximum progress. The
309    * animation will play between those values.
310    */
311   void SetPlayRange( const Vector2& range );
312
313   /**
314    * @brief Get the playing range
315    *
316    * @return The play range defined for the animation.
317    */
318   Vector2 GetPlayRange() const;
319
320   /**
321    * @brief Play the animation.
322    */
323   void Play();
324
325   /**
326    * @brief Play the animation from a given point.
327    * The progress must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
328    * otherwise, it will be ignored.
329    *
330    * @param[in] progress A value between [0,1], or between the play range if specified, form where the animation should start playing
331    */
332   void PlayFrom( float progress );
333
334   /**
335    * @brief Pause the animation.
336    */
337   void Pause();
338
339   /**
340    * @brief Stop the animation.
341    */
342   void Stop();
343
344   /**
345    * @brief Clear the animation.
346    *
347    * This disconnects any objects that were being animated, effectively stopping the animation.
348    */
349   void Clear();
350
351   /**
352    * @brief Connect to this signal to be notified when an Animation's animations have finished.
353    *
354    * @return A signal object to Connect() with.
355    */
356   AnimationSignalV2& FinishedSignal();
357
358   /**
359    * @brief Animate a property value by a relative amount.
360    *
361    * The default alpha function will be used.
362    * The effect will start & end when the animation begins & ends.
363    * @param [in] target The target object/property to animate.
364    * @param [in] relativeValue The property value will change by this amount.
365    */
366   void AnimateBy(Property target, Property::Value relativeValue);
367
368   /**
369    * @brief Animate a property value by a relative amount.
370    *
371    * The effect will start & end when the animation begins & ends.
372    * @param [in] target The target object/property to animate.
373    * @param [in] relativeValue The property value will change by this amount.
374    * @param [in] alpha The alpha function to apply.
375    */
376   void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
377
378   /**
379    * @brief Animate a property value by a relative amount.
380    *
381    * The default alpha function will be used.
382    * @param [in] target The target object/property to animate.
383    * @param [in] relativeValue The property value will increase/decrease by this amount.
384    * @param [in] period The effect will occur during this time period.
385    */
386   void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
387
388   /**
389    * @brief Animate a property value by a relative amount.
390    *
391    * @param [in] target The target object/property to animate.
392    * @param [in] relativeValue The property value will increase/decrease by this amount.
393    * @param [in] alpha The alpha function to apply.
394    * @param [in] period The effect will occur during this time period.
395    */
396   void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
397
398   /**
399    * @brief Animate a property to a destination value.
400    *
401    * The default alpha function will be used.
402    * The effect will start & end when the animation begins & ends.
403    * @param [in] target The target object/property to animate.
404    * @param [in] destinationValue The destination value.
405    */
406   void AnimateTo(Property target, Property::Value destinationValue);
407
408   /**
409    * @brief Animate a property to a destination value.
410    *
411    * The effect will start & end when the animation begins & ends.
412    * @param [in] target The target object/property to animate.
413    * @param [in] destinationValue The destination value.
414    * @param [in] alpha The alpha function to apply.
415    */
416   void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
417
418   /**
419    * @brief Animate a property to a destination value.
420    *
421    * The default alpha function will be used.
422    * @param [in] target The target object/property to animate.
423    * @param [in] destinationValue The destination value.
424    * @param [in] period The effect will occur during this time period.
425    */
426   void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
427
428   /**
429    * @brief Animate a property to a destination value.
430    *
431    * @param [in] target The target object/property to animate.
432    * @param [in] destinationValue The destination value.
433    * @param [in] alpha The alpha function to apply.
434    * @param [in] period The effect will occur during this time period.
435    */
436   void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
437
438   /**
439    * @brief Animate a property between keyframes.
440    *
441    * @param [in] target The target object/property to animate.
442    * @param [in] keyFrames The key frames
443    */
444   void AnimateBetween(Property target, KeyFrames& keyFrames);
445
446   /**
447    * @brief Animate a property between keyframes.
448    *
449    * @param [in] target The target object/property to animate.
450    * @param [in] keyFrames The key frames
451    * @param [in] alpha The alpha function to apply.
452    */
453   void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
454
455   /**
456    * @brief Animate a property between keyframes.
457    *
458    * @param [in] target The target object/property to animate.
459    * @param [in] keyFrames The key frames
460    * @param [in] period The effect will occur during this time period.
461    */
462   void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
463
464   /**
465    * @brief Animate a property between keyframes.
466    *
467    * @param [in] target The target object/property to animate.
468    * @param [in] keyFrames The key frames
469    * @param [in] alpha The alpha function to apply.
470    * @param [in] period The effect will occur during this time period.
471    */
472   void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
473
474   /**
475    * @brief Animate a property using a custom function.
476    *
477    * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
478    * @pre The property type is equal PropertyTypes::Get<P>().
479    * @param [in] target The target object/property to animate.
480    * @param [in] animatorFunc The function to call during the animation.
481    */
482   template <class P>
483   void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc )
484   {
485     Animate( target, PropertyTypes::Get<P>(), animatorFunc );
486   }
487
488   /**
489    * @brief Animate a property using a custom function.
490    *
491    * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
492    * @pre The property type is equal PropertyTypes::Get<P>().
493    * @param [in] target The target object/property to animate.
494    * @param [in] animatorFunc The function to call during the animation.
495    * @param [in] alpha The alpha function to apply.
496    */
497   template <class P>
498   void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha )
499   {
500     Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha );
501   }
502
503   /**
504    * @brief Animate a property using a custom function.
505    *
506    * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
507    * @pre The property type is equal PropertyTypes::Get<P>().
508    * @param [in] target The target object/property to animate.
509    * @param [in] animatorFunc The function to call during the animation.
510    * @param [in] period The effect will occur during this time period.
511    */
512   template <class P>
513   void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, TimePeriod period )
514   {
515     Animate( target, PropertyTypes::Get<P>(), animatorFunc, period );
516   }
517
518   /**
519    * @brief Animate a property using a custom function.
520    *
521    * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
522    * @pre The property type is equal PropertyTypes::Get<P>().
523    * @param [in] target The target object/property to animate.
524    * @param [in] animatorFunc The function to call during the animation.
525    * @param [in] alpha The alpha function to apply.
526    * @param [in] period The effect will occur during this time period.
527    */
528   template <class P>
529   void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha, TimePeriod period )
530   {
531     Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha, period );
532   }
533
534   // Actor-specific convenience methods
535
536   /**
537    * @brief Move an actor relative to its position.
538    *
539    * The default alpha function will be used.
540    * The move will start & end when the animation begins & ends.
541    * @param [in] actor The actor to animate.
542    * @param [in] x axis displacement.
543    * @param [in] y axis displacement.
544    * @param [in] z axis displacement.
545    */
546   void MoveBy(Actor actor, float x, float y, float z);
547
548   /**
549    * @brief Move an actor relative to its position.
550    *
551    * This overload allows the alpha function to be customized.
552    * The move will start & end when the animation begins & ends.
553    * @param [in] actor The actor to animate.
554    * @param [in] displacement relative to current position.
555    * @param [in] alpha The alpha function to apply.
556    */
557   void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
558
559   /**
560    * @brief Move an actor relative to its position.
561    *
562    * This overload allows the translation start & end time to be customized.
563    * @pre delaySeconds must be zero or greater.
564    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
565    * @param [in] actor The actor to animate.
566    * @param [in] displacement relative to current position.
567    * @param [in] alpha The alpha function to apply.
568    * @param [in] delaySeconds The initial delay from the start of the animation.
569    * @param [in] durationSeconds The duration of the translation.
570    */
571   void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
572
573   /**
574    * @brief Move an actor to a target position.
575    *
576    * The default alpha function will be used.
577    * The move will start & end when the animation begins & ends.
578    * @param [in] actor The actor to animate.
579    * @param [in] x axis position.
580    * @param [in] y axis position.
581    * @param [in] z axis position.
582    */
583   void MoveTo(Actor actor, float x, float y, float z);
584
585   /**
586    * @brief Move an actor to a target position.
587    *
588    * This overload allows the alpha function to be customized.
589    * The move will start & end when the animation begins & ends.
590    * @param [in] actor The actor to animate.
591    * @param [in] position to move to
592    * @param [in] alpha The alpha function to apply.
593    */
594   void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
595
596   /**
597    * @brief Move an actor to a target position.
598    *
599    * This overload allows the translation start & end time to be customized.
600    * @pre delaySeconds must be zero or greater.
601    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
602    * @param [in] actor The actor to animate.
603    * @param [in] position to move to
604    * @param [in] alpha The alpha function to apply.
605    * @param [in] delaySeconds The initial delay from the start of the animation.
606    * @param [in] durationSeconds The duration of the translation.
607    */
608   void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
609
610   /**
611    * @brief Move an actor using a custom function.
612    *
613    * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
614    * @pre delaySeconds must be zero or greater.
615    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
616    * @param [in] actor The actor to animate.
617    * @param [in] animatorFunc The function to call during the animation.
618    * @param [in] alpha The alpha function to apply.
619    * @param [in] delaySeconds The initial delay from the start of the animation.
620    * @param [in] durationSeconds The duration of the translation.
621    */
622   void Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
623
624   /**
625    * @brief Rotate an actor around an arbitrary axis.
626    *
627    * The default alpha function will be used.
628    * The rotation will start & end when the animation begins & ends.
629    * @param [in] actor The actor to animate.
630    * @param [in] angle The angle in degrees.
631    * @param [in] axis The axis to rotate around
632    */
633   void RotateBy(Actor actor, Degree angle, Vector3 axis);
634
635   /**
636    * @brief Rotate an actor around an arbitrary axis.
637    *
638    * The default alpha function will be used.
639    * The rotation will start & end when the animation begins & ends.
640    * @param [in] actor The actor to animate.
641    * @param [in] angle The angle in radians.
642    * @param [in] axis The axis to rotate around
643    */
644   void RotateBy(Actor actor, Radian angle, Vector3 axis);
645
646   /**
647    * @brief Rotate an actor around an arbitrary axis.
648    *
649    * This overload allows the alpha function to be customized.
650    * The rotation will start & end when the animation begins & ends.
651    * @param [in] actor The actor to animate.
652    * @param [in] angle The angle in radians.
653    * @param [in] axis The axis to rotate around.
654    * @param [in] alpha The alpha function to apply.
655    */
656   void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
657
658   /**
659    * @brief Rotate an actor around an arbitrary axis.
660    *
661    * This overload allows the alpha function to be customized.
662    * The rotation will start & end when the animation begins & ends.
663    * @param [in] actor The actor to animate.
664    * @param [in] angle The angle in radians.
665    * @param [in] axis The axis to rotate around.
666    * @param [in] alpha The alpha function to apply.
667    */
668   void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
669
670   /**
671    * @brief Rotate an actor around an arbitrary axis.
672    *
673    * This overload allows the rotation start & end time to be customized.
674    * @pre delaySeconds must be zero or greater.
675    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
676    * @param [in] actor The actor to animate.
677    * @param [in] angle The angle in degrees.
678    * @param [in] axis The axis to rotate around
679    * @param [in] alpha The alpha function to apply.
680    * @param [in] delaySeconds The initial delay from the start of the animation.
681    * @param [in] durationSeconds The duration of the rotation.
682    */
683   void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
684
685   /**
686    * @brief Rotate an actor around an arbitrary axis.
687    *
688    * This overload allows the rotation start & end time to be customized.
689    * @pre delaySeconds must be zero or greater.
690    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
691    * @param [in] actor The actor to animate.
692    * @param [in] angle The angle in radians.
693    * @param [in] axis The axis to rotate around
694    * @param [in] alpha The alpha function to apply.
695    * @param [in] delaySeconds The initial delay from the start of the animation.
696    * @param [in] durationSeconds The duration of the rotation.
697    */
698   void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
699
700   /**
701    * @brief Rotate an actor to a target orientation.
702    *
703    * The default alpha function will be used.
704    * The rotation will start & end when the animation begins & ends.
705    * @param [in] actor The actor to animate.
706    * @param [in] angle The target rotation angle in degrees.
707    * @param [in] axis The target axis of rotation.
708    */
709   void RotateTo(Actor actor, Degree angle, Vector3 axis);
710
711   /**
712    * @brief Rotate an actor to a target orientation.
713    *
714    * The default alpha function will be used.
715    * The rotation will start & end when the animation begins & ends.
716    * @param [in] actor The actor to animate.
717    * @param [in] angle The target rotation angle in radians.
718    * @param [in] axis The target axis of rotation.
719    */
720   void RotateTo(Actor actor, Radian angle, Vector3 axis);
721
722   /**
723    * @brief Rotate an actor to a target orientation.
724    *
725    * The default alpha function will be used.
726    * The rotation will start & end when the animation begins & ends.
727    * @param [in] actor The actor to animate.
728    * @param [in] orientation The target orientation.
729    */
730   void RotateTo(Actor actor, Quaternion orientation);
731
732   /**
733    * @brief Rotate an actor to a target orientation.
734    *
735    * This overload allows the alpha function to be customized.
736    * The rotation will start & end when the animation begins & ends.
737    * @param [in] actor The actor to animate.
738    * @param [in] angle The target rotation angle in degrees.
739    * @param [in] axis The target axis of rotation.
740    * @param [in] alpha The alpha function to apply.
741    */
742   void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
743
744   /**
745    * @brief Rotate an actor to a target orientation.
746    *
747    * This overload allows the alpha function to be customized.
748    * The rotation will start & end when the animation begins & ends.
749    * @param [in] actor The actor to animate.
750    * @param [in] angle The target rotation angle in radians.
751    * @param [in] axis The target axis of rotation.
752    * @param [in] alpha The alpha function to apply.
753    */
754   void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
755
756   /**
757    * @brief Rotate an actor to a target orientation.
758    *
759    * This overload allows the alpha function to be customized.
760    * The rotation will start & end when the animation begins & ends.
761    * @param [in] actor The actor to animate.
762    * @param [in] orientation The target orientation.
763    * @param [in] alpha The alpha function to apply.
764    */
765   void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
766
767   /**
768    * @brief Rotate an actor to a target orientation.
769    *
770    * This overload allows the rotation start & end time to be customized.
771    * @pre delaySeconds must be zero or greater.
772    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
773    * @param [in] actor The actor to animate.
774    * @param [in] angle The target rotation angle in degrees.
775    * @param [in] axis The target axis of rotation.
776    * @param [in] alpha The alpha function to apply.
777    * @param [in] delaySeconds The initial delay from the start of the animation.
778    * @param [in] durationSeconds The duration of the rotation.
779    */
780   void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
781
782   /**
783    * @brief Rotate an actor to a target orientation.
784    *
785    * This overload allows the rotation start & end time to be customized.
786    * @pre delaySeconds must be zero or greater.
787    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
788    * @param [in] actor The actor to animate.
789    * @param [in] angle The target rotation angle in radians.
790    * @param [in] axis The target axis of rotation.
791    * @param [in] alpha The alpha function to apply.
792    * @param [in] delaySeconds The initial delay from the start of the animation.
793    * @param [in] durationSeconds The duration of the rotation.
794    */
795   void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
796
797   /**
798    * @brief Rotate an actor to a target orientation.
799    *
800    * This overload allows the rotation start & end time to be customized.
801    * @pre delaySeconds must be zero or greater.
802    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
803    * @param [in] actor The actor to animate.
804    * @param [in] orientation The target orientation.
805    * @param [in] alpha The alpha function to apply.
806    * @param [in] delaySeconds The initial delay from the start of the animation.
807    * @param [in] durationSeconds The duration of the rotation.
808    */
809   void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
810
811   /**
812    * @brief Rotate an actor using a custom function.
813    *
814    * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
815    * @pre delaySeconds must be zero or greater.
816    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
817    * @param [in] actor The actor to animate.
818    * @param [in] animatorFunc The function to call during the animation.
819    * @param [in] alpha The alpha function to apply.
820    * @param [in] delaySeconds The initial delay from the start of the animation.
821    * @param [in] durationSeconds The duration of the rotation.
822    */
823   void Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
824
825   /**
826    * @brief Scale an actor.
827    *
828    * The default alpha function will be used.
829    * The scaling will start & end when the animation begins & ends.
830    * @param [in] actor The actor to animate.
831    * @param [in] x Scale factor in the X-direction.
832    * @param [in] y Scale factor in the Y-direction.
833    * @param [in] z Scale factor in the Z-direction.
834    */
835   void ScaleBy(Actor actor, float x, float y, float z);
836
837   /**
838    * @brief Scale an actor.
839    *
840    * This overload allows the alpha function to be customized.
841    * The scaling will start & end when the animation begins & ends.
842    * @param [in] actor The actor to animate.
843    * @param [in] scale The scale factor.
844    * @param [in] alpha The alpha function to apply.
845    */
846   void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
847
848   /**
849    * @brief Scale an actor.
850    *
851    * This overload allows the scaling start & end time to be customized.
852    * @pre delaySeconds must be zero or greater.
853    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
854    * @param [in] actor The actor to animate.
855    * @param [in] scale The scale factor.
856    * @param [in] alpha The alpha function to apply.
857    * @param [in] delaySeconds The initial delay from the start of the animation.
858    * @param [in] durationSeconds The duration of the scaling.
859    */
860   void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
861
862   /**
863    * @brief Scale an actor to a target scale factor.
864    *
865    * The default alpha function will be used.
866    * The scaling will start & end when the animation begins & ends.
867    * @param [in] actor The actor to animate.
868    * @param [in] x Target scale-factor in the X-direction.
869    * @param [in] y Target scale-factor in the Y-direction.
870    * @param [in] z Target scale-factor in the Z-direction.
871    */
872   void ScaleTo(Actor actor, float x, float y, float z);
873
874   /**
875    * @brief Scale an actor to a target scale factor.
876    *
877    * This overload allows the alpha function to be customized.
878    * The scaling will start & end when the animation begins & ends.
879    * @param [in] actor The actor to animate.
880    * @param [in] scale The target scale factor.
881    * @param [in] alpha The alpha function to apply.
882    */
883   void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
884
885   /**
886    * @brief Scale an actor to a target scale factor.
887    *
888    * This overload allows the scaling start & end time to be customized.
889    * @pre delaySeconds must be zero or greater.
890    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
891    * @param [in] actor The actor to animate.
892    * @param [in] scale The target scale factor.
893    * @param [in] alpha The alpha function to apply.
894    * @param [in] delaySeconds The initial delay from the start of the animation.
895    * @param [in] durationSeconds The duration of the scaling.
896    */
897   void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
898
899   /**
900    * @brief Show an actor during the animation.
901    *
902    * @param [in] actor The actor to animate.
903    * @param [in] delaySeconds The initial delay from the start of the animation.
904    */
905   void Show(Actor actor, float delaySeconds);
906
907   /**
908    * @brief Hide an actor during the animation.
909    *
910    * @param [in] actor The actor to animate.
911    * @param [in] delaySeconds The initial delay from the start of the animation.
912    */
913   void Hide(Actor actor, float delaySeconds);
914
915   /**
916    * @brief Animate the opacity of an actor.
917    *
918    * The default alpha function will be used.
919    * The effect will start & end when the animation begins & ends.
920    * @param [in] actor The actor to animate.
921    * @param [in] opacity The relative change in opacity.
922    */
923   void OpacityBy(Actor actor, float opacity);
924
925   /**
926    * @brief Animate the opacity of an actor.
927    *
928    * This overload allows the alpha function to be customized.
929    * The effect will start & end when the animation begins & ends.
930    * @param [in] actor The actor to animate.
931    * @param [in] opacity The relative change in opacity.
932    * @param [in] alpha The alpha function to apply.
933    */
934   void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
935
936   /**
937    * @brief Animate the opacity of an actor.
938    *
939    * This overload allows the animation start & end time to be customized.
940    * @pre delaySeconds must be zero or greater.
941    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
942    * @param [in] actor The actor to animate.
943    * @param [in] opacity The relative change in opacity.
944    * @param [in] alpha The alpha function to apply.
945    * @param [in] delaySeconds The initial delay from the start of the animation.
946    * @param [in] durationSeconds The duration of the opacity animation.
947    */
948   void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
949
950   /**
951    * @brief Animate an actor to a target opacity.
952    *
953    * The default alpha function will be used.
954    * The effect will start & end when the animation begins & ends.
955    * @param [in] actor The actor to animate.
956    * @param [in] opacity The target opacity.
957    */
958   void OpacityTo(Actor actor, float opacity);
959
960   /**
961    * @brief Animate an actor to a target opacity.
962    *
963    * This overload allows the alpha function to be customized.
964    * The effect will start & end when the animation begins & ends.
965    * @param [in] actor The actor to animate.
966    * @param [in] opacity The target opacity.
967    * @param [in] alpha The alpha function to apply.
968    */
969   void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
970
971   /**
972    * @brief Animate an actor to a target opacity.
973    *
974    * This overload allows the animation start & end time to be customized.
975    * @pre delaySeconds must be zero or greater.
976    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
977    * @param [in] actor The actor to animate.
978    * @param [in] opacity The target opacity.
979    * @param [in] alpha The alpha function to apply.
980    * @param [in] delaySeconds The initial delay from the start of the animation.
981    * @param [in] durationSeconds The duration of the opacity animation.
982    */
983   void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
984
985   /**
986    * @brief Animate the color of an actor.
987    *
988    * The default alpha function will be used.
989    * The effect will start & end when the animation begins & ends.
990    * @param [in] actor The actor to animate.
991    * @param [in] color The relative change in color.
992    */
993   void ColorBy(Actor actor, Vector4 color);
994
995   /**
996    * @brief Animate the color of an actor.
997    *
998    * This overload allows the alpha function to be customized.
999    * The effect will start & end when the animation begins & ends.
1000    * @param [in] actor The actor to animate.
1001    * @param [in] color The relative change in color.
1002    * @param [in] alpha The alpha function to apply.
1003    */
1004   void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
1005
1006   /**
1007    * @brief Animate the color of an actor.
1008    *
1009    * This overload allows the animation start & end time to be customized.
1010    * @pre delaySeconds must be zero or greater.
1011    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1012    * @param [in] actor The actor to animate.
1013    * @param [in] color The relative change in color.
1014    * @param [in] alpha The alpha function to apply.
1015    * @param [in] delaySeconds The initial delay from the start of the animation.
1016    * @param [in] durationSeconds The duration of the color animation.
1017    */
1018   void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1019
1020   /**
1021    * @brief Animate an actor to a target color.
1022    *
1023    * The default alpha function will be used.
1024    * The effect will start & end when the animation begins & ends.
1025    * @param [in] actor The actor to animate.
1026    * @param [in] color The target color.
1027    */
1028   void ColorTo(Actor actor, Vector4 color);
1029
1030   /**
1031    * @brief Animate an actor to a target color.
1032    *
1033    * This overload allows the alpha function to be customized.
1034    * The effect will start & end when the animation begins & ends.
1035    * @param [in] actor The actor to animate.
1036    * @param [in] color The target color.
1037    * @param [in] alpha The alpha function to apply.
1038    */
1039   void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
1040
1041   /**
1042    * @brief Animate an actor to a target color.
1043    *
1044    * This overload allows the animation start & end time to be customized.
1045    * @pre delaySeconds must be zero or greater.
1046    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1047    * @param [in] actor The actor to animate.
1048    * @param [in] color The target color.
1049    * @param [in] alpha The alpha function to apply.
1050    * @param [in] delaySeconds The initial delay from the start of the animation.
1051    * @param [in] durationSeconds The duration of the color animation.
1052    */
1053   void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1054
1055   /**
1056    * @brief Resize an actor.
1057    *
1058    * The default alpha function will be used.
1059    * The resizing will start & end when the animation begins & ends.
1060    * The depth defaults to the minimum of width & height.
1061    * @param [in] actor The actor to animate.
1062    * @param [in] width The target width.
1063    * @param [in] height The target height.
1064    */
1065   void Resize(Actor actor, float width, float height);
1066
1067   /**
1068    * @brief Resize an actor.
1069    *
1070    * This overload allows the alpha function to be customized.
1071    * The resizing will start & end when the animation begins & ends.
1072    * The depth defaults to the minimum of width & height.
1073    * @param [in] actor The actor to animate.
1074    * @param [in] width The target width.
1075    * @param [in] height The target height.
1076    * @param [in] alpha The alpha function to apply.
1077    */
1078   void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1079
1080   /**
1081    * @brief Resize an actor.
1082    *
1083    * This overload allows the resizing start & end time to be customized.
1084    * The depth defaults to the minimum of width & height.
1085    * @pre delaySeconds must be zero or greater.
1086    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1087    * @param [in] actor The actor to animate.
1088    * @param [in] width The target width.
1089    * @param [in] height The target height.
1090    * @param [in] alpha The alpha function to apply.
1091    * @param [in] delaySeconds The initial delay from the start of the animation.
1092    * @param [in] durationSeconds The duration of the resizing.
1093    */
1094   void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1095
1096   /**
1097    * @brief Resize an actor.
1098    *
1099    * The default alpha function will be used.
1100    * The resizing will start & end when the animation begins & ends.
1101    * @param [in] actor The actor to animate.
1102    * @param [in] size The target size.
1103    */
1104   void Resize(Actor actor, Vector3 size);
1105
1106   /**
1107    * @brief Resize an actor.
1108    *
1109    * This overload allows the alpha function to be customized.
1110    * The resizing will start & end when the animation begins & ends.
1111    * @param [in] actor The actor to animate.
1112    * @param [in] size The target size.
1113    * @param [in] alpha The alpha function to apply.
1114    */
1115   void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1116
1117   /**
1118    * @brief Resize an actor.
1119    *
1120    * This overload allows the resizing start & end time to be customized.
1121    * @pre delaySeconds must be zero or greater.
1122    * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1123    * @param [in] actor The actor to animate.
1124    * @param [in] size The target size.
1125    * @param [in] alpha The alpha function to apply.
1126    * @param [in] delaySeconds The initial delay from the start of the animation.
1127    * @param [in] durationSeconds The duration of the resizing.
1128    */
1129   void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1130
1131 public: // Not intended for use by Application developers
1132
1133   /**
1134    * @brief This constructor is used by Dali New() methods
1135    * @param [in] animation A pointer to a newly allocated Dali resource
1136    */
1137   explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1138
1139 private:
1140
1141   /**
1142    * @brief Animate a property using a custom function.
1143    *
1144    * @pre The property type is equal expectedType.
1145    * @param [in] target The target object/property to animate.
1146    * @param [in] targetType The expected type of the property.
1147    * @param [in] func The function to call during the animation.
1148    */
1149   void Animate( Property target,
1150                 Property::Type targetType,
1151                 AnyFunction func );
1152
1153   /**
1154    * @brief Animate a property using a custom function.
1155    *
1156    * @pre The property type is equal expectedType.
1157    * @param [in] target The target object/property to animate.
1158    * @param [in] targetType The expected type of the property.
1159    * @param [in] func The function to call during the animation.
1160    * @param [in] alpha The alpha function to apply.
1161    */
1162   void Animate( Property target,
1163                 Property::Type targetType,
1164                 AnyFunction func,
1165                 AlphaFunction alpha );
1166
1167   /**
1168    * @brief Animate a property using a custom function.
1169    *
1170    * @pre The property type is equal expectedType.
1171    * @param [in] target The target object/property to animate.
1172    * @param [in] targetType The expected type of the property.
1173    * @param [in] func The function to call during the animation.
1174    * @param [in] period The effect will occur during this time period.
1175    */
1176   void Animate( Property target,
1177                 Property::Type targetType,
1178                 AnyFunction func,
1179                 TimePeriod period );
1180
1181   /**
1182    * @brief Animate a property using a custom function.
1183    *
1184    * @pre The property type is equal expectedType.
1185    * @param [in] target The target object/property to animate.
1186    * @param [in] targetType The expected type of the property.
1187    * @param [in] func The function to call during the animation.
1188    * @param [in] alpha The alpha function to apply.
1189    * @param [in] period The effect will occur during this time period.
1190    */
1191   void Animate( Property target,
1192                 Property::Type targetType,
1193                 AnyFunction func,
1194                 AlphaFunction alpha,
1195                 TimePeriod period );
1196 };
1197
1198 } // namespace Dali
1199
1200 #endif // __DALI_ANIMATION_H__