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