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