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