1 #ifndef __DALI_ANIMATION_H__
2 #define __DALI_ANIMATION_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <boost/function.hpp>
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>
33 namespace Dali DALI_IMPORT_API
46 typedef boost::function<bool (float alpha, const bool& current)> AnimatorFunctionBool; ///< Animator function signature for boolean properties.
47 typedef boost::function<float (float alpha, const float& current)> AnimatorFunctionFloat; ///< Animator function signature for float properties.
48 typedef boost::function<int (float alpha, const int& current)> AnimatorFunctionInteger; ///< Animator function signature for integer properties.
49 typedef boost::function<Vector2 (float alpha, const Vector2& current)> AnimatorFunctionVector2; ///< Animator function signature for Vector2 properties.
50 typedef boost::function<Vector3 (float alpha, const Vector3& current)> AnimatorFunctionVector3; ///< Animator function signature for Vector3 properties.
51 typedef boost::function<Vector4 (float alpha, const Vector4& current)> AnimatorFunctionVector4; ///< Animator function signature for Vector4 properties.
52 typedef boost::function<Quaternion (float alpha, const Quaternion& current)> AnimatorFunctionQuaternion;///< Animator function signature for Quaternion properties.
54 namespace Internal DALI_INTERNAL
60 * @brief Dali::Animation can be used to animate the properties of any number of objects, typically Actors.
62 * An example animation setup is shown below:
68 * Actor mActor; // The object we wish to animate
69 * Animation mAnimation; // Keep this to control the animation
72 * // ...To play the animation
74 * mAnimation = Animation::New(3.0f); // duration 3 seconds
75 * mAnimation.MoveTo(mActor, 10.0f, 50.0f, 0.0f);
80 * Dali::Animation supports "fire and forget" behaviour i.e. an animation continues to play if the handle is discarded.
81 * Note that in the following example, the "Finish" signal will be emitted:
85 * void ExampleCallback( Animation& source )
87 * std::cout << "Animation has finished" << std::endl;
90 * void ExampleAnimation( Actor actor )
92 * Animation animation = Animation::New(2.0f); // duration 2 seconds
93 * animation.MoveTo(actor, 10.0f, 50.0f, 0.0f);
94 * animation.FinishedSignal().Connect( ExampleCallback );
96 * } // At this point the animation handle has gone out of scope
98 * Actor actor = Actor::New();
99 * Stage::GetCurrent().Add( actor );
101 * // Fire animation and forget about it
102 * ExampleAnimation( actor );
104 * // However the animation will continue, and "Animation has finished" will be printed after 2 seconds.
108 * If the "Finish" signal is connected to a member function of an object, it must be disconnected before the object is destroyed.
109 * This is typically done in the object destructor, and requires either the Dali::Connection object or Dali::Animation handle to be stored.
111 class DALI_IMPORT_API Animation : public BaseHandle
115 typedef SignalV2< void (Animation&) > AnimationSignalV2; ///< Animation finished signal type
117 typedef Any AnyFunction; ///< Interpolation function
118 typedef boost::function<Vector3 (float alpha, const Vector3& current)> Vector3AnimatorFunc; ///< Interpolation function
119 typedef boost::function<Quaternion (float alpha, const Quaternion& current)> QuaternionAnimatorFunc; ///< Interpolation function
122 * @brief What to do when the animation ends, is stopped or is destroyed
126 Bake, ///< When the animation ends, the animated property values are saved.
127 Discard, ///< When the animation ends, the animated property values are forgotten.
128 BakeFinal ///< If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Bake.
132 static const char* const SIGNAL_FINISHED; ///< name "finished"
135 static const char* const ACTION_PLAY; ///< name "play"
136 static const char* const ACTION_STOP; ///< name "stop"
137 static const char* const ACTION_PAUSE; ///< name "pause"
140 * @brief Create an uninitialized Animation; this can be initialized with Animation::New().
142 * Calling member functions with an uninitialized Dali::Object is not allowed.
147 * @brief Create an initialized Animation.
149 * The animation will not loop.
150 * The default end action is "Bake".
151 * The default alpha function is linear.
152 * @pre durationSeconds must be greater than zero.
153 * @param [in] durationSeconds The duration in seconds.
154 * @return A handle to a newly allocated Dali resource.
156 static Animation New(float durationSeconds);
159 * @brief Downcast an Object handle to Animation.
161 * If handle points to an Animation object the downcast produces
162 * valid handle. If not the returned handle is left uninitialized.
164 * @param[in] handle to An object
165 * @return handle to a Animation object or an uninitialized handle
167 static Animation DownCast( BaseHandle handle );
172 * This is non-virtual since derived Handle types must not contain data or virtual methods.
177 * @brief This copy constructor is required for (smart) pointer semantics.
179 * @param [in] handle A reference to the copied handle
181 Animation(const Animation& handle);
184 * @brief This assignment operator is required for (smart) pointer semantics.
186 * @param [in] rhs A reference to the copied handle
187 * @return A reference to this
189 Animation& operator=(const Animation& rhs);
192 * @brief This method is defined to allow assignment of the NULL value,
193 * and will throw an exception if passed any other value.
195 * Assigning to NULL is an alias for Reset().
196 * @param [in] rhs A NULL pointer
197 * @return A reference to this handle
199 Animation& operator=(BaseHandle::NullType* rhs);
202 * @brief Set the duration of an animation.
204 * @pre durationSeconds must be greater than zero.
205 * @param[in] seconds The duration in seconds.
207 void SetDuration(float seconds);
210 * @brief Retrieve the duration of an animation.
212 * @return The duration in seconds.
214 float GetDuration() const;
217 * @brief Set whether the animation will loop.
219 * @param[in] looping True if the animation will loop.
221 void SetLooping(bool looping);
224 * @brief Query whether the animation will loop.
226 * @return True if the animation will loop.
228 bool IsLooping() const;
231 * @brief Set the end action of the animation.
233 * This action is performed when the animation ends.
234 * Default end action is bake
235 * @param[in] action The end action.
237 void SetEndAction(EndAction action);
240 * @brief Returns the end action of the animation.
242 * @return The end action.
244 EndAction GetEndAction() const;
247 * @brief Set the destroy action of the animation.
249 * If the animation is destroyed this action is performed on the following update.
250 * Default destroy action is bake
251 * @param[in] action The destroy action.
253 void SetDestroyAction(EndAction action);
256 * @brief Returns the destroy action of the animation.
258 * @return The destroy action.
260 EndAction GetDestroyAction() const;
263 * @brief Set the default alpha function for an animation.
265 * This is applied to individual property animations, if no further alpha functions are supplied.
266 * @param[in] alpha The default alpha function.
268 void SetDefaultAlphaFunction(AlphaFunction alpha);
271 * @brief Retrieve the default alpha function for an animation.
273 * @return The default alpha function.
275 AlphaFunction GetDefaultAlphaFunction() const;
278 * @brief Retrieve the current progress of the animation.
280 * @return The current progress as a normalized value between [0,1].
282 float GetCurrentProgress();
285 * @brief Sets the progress of the animation.
286 * The animation will play (or continue playing) from this point
288 * @param[in] progress The new progress as a normalized value between [0,1].
290 void SetCurrentProgress( float progress );
293 * @brief Play the animation.
298 * @brief Play the animation from a given point.
299 * @param[in] progress A value between [0,1] form where the animation should start playing
301 void PlayFrom( float progress );
304 * @brief Pause the animation.
309 * @brief Stop the animation.
314 * @brief Clear the animation.
316 * This disconnects any objects that were being animated, effectively stopping the animation.
321 * @brief Connect to this signal to be notified when an Animation's animations have finished.
323 * @return A signal object to Connect() with.
325 AnimationSignalV2& FinishedSignal();
328 * @brief Animate a property value by a relative amount.
330 * The default alpha function will be used.
331 * The effect will start & end when the animation begins & ends.
332 * @param [in] target The target object/property to animate.
333 * @param [in] relativeValue The property value will change by this amount.
335 void AnimateBy(Property target, Property::Value relativeValue);
338 * @brief Animate a property value by a relative amount.
340 * The effect will start & end when the animation begins & ends.
341 * @param [in] target The target object/property to animate.
342 * @param [in] relativeValue The property value will change by this amount.
343 * @param [in] alpha The alpha function to apply.
345 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
348 * @brief Animate a property value by a relative amount.
350 * The default alpha function will be used.
351 * @param [in] target The target object/property to animate.
352 * @param [in] relativeValue The property value will increase/decrease by this amount.
353 * @param [in] period The effect will occur during this time period.
355 void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
358 * @brief Animate a property value by a relative amount.
360 * @param [in] target The target object/property to animate.
361 * @param [in] relativeValue The property value will increase/decrease by this amount.
362 * @param [in] alpha The alpha function to apply.
363 * @param [in] period The effect will occur during this time period.
365 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
368 * @brief Animate a property to a destination value.
370 * The default alpha function will be used.
371 * The effect will start & end when the animation begins & ends.
372 * @param [in] target The target object/property to animate.
373 * @param [in] destinationValue The destination value.
375 void AnimateTo(Property target, Property::Value destinationValue);
378 * @brief Animate a property to a destination value.
380 * The effect will start & end when the animation begins & ends.
381 * @param [in] target The target object/property to animate.
382 * @param [in] destinationValue The destination value.
383 * @param [in] alpha The alpha function to apply.
385 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
388 * @brief Animate a property to a destination value.
390 * The default alpha function will be used.
391 * @param [in] target The target object/property to animate.
392 * @param [in] destinationValue The destination value.
393 * @param [in] period The effect will occur during this time period.
395 void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
398 * @brief Animate a property to a destination value.
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 * @param [in] period The effect will occur during this time period.
405 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
408 * @brief Animate a property between keyframes.
410 * @param [in] target The target object/property to animate.
411 * @param [in] keyFrames The key frames
413 void AnimateBetween(Property target, KeyFrames& keyFrames);
416 * @brief Animate a property between keyframes.
418 * @param [in] target The target object/property to animate.
419 * @param [in] keyFrames The key frames
420 * @param [in] alpha The alpha function to apply.
422 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
425 * @brief Animate a property between keyframes.
427 * @param [in] target The target object/property to animate.
428 * @param [in] keyFrames The key frames
429 * @param [in] period The effect will occur during this time period.
431 void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
434 * @brief Animate a property between keyframes.
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 * @param [in] period The effect will occur during this time period.
441 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
444 * @brief Animate a property using a custom function.
446 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
447 * @pre The property type is equal PropertyTypes::Get<P>().
448 * @param [in] target The target object/property to animate.
449 * @param [in] animatorFunc The function to call during the animation.
452 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc )
454 Animate( target, PropertyTypes::Get<P>(), animatorFunc );
458 * @brief Animate a property using a custom function.
460 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
461 * @pre The property type is equal PropertyTypes::Get<P>().
462 * @param [in] target The target object/property to animate.
463 * @param [in] animatorFunc The function to call during the animation.
464 * @param [in] alpha The alpha function to apply.
467 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha )
469 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha );
473 * @brief Animate a property using a custom function.
475 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
476 * @pre The property type is equal PropertyTypes::Get<P>().
477 * @param [in] target The target object/property to animate.
478 * @param [in] animatorFunc The function to call during the animation.
479 * @param [in] period The effect will occur during this time period.
482 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, TimePeriod period )
484 Animate( target, PropertyTypes::Get<P>(), animatorFunc, period );
488 * @brief Animate a property using a custom function.
490 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
491 * @pre The property type is equal PropertyTypes::Get<P>().
492 * @param [in] target The target object/property to animate.
493 * @param [in] animatorFunc The function to call during the animation.
494 * @param [in] alpha The alpha function to apply.
495 * @param [in] period The effect will occur during this time period.
498 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha, TimePeriod period )
500 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha, period );
503 // Actor-specific convenience methods
506 * @brief Move an actor relative to its position.
508 * The default alpha function will be used.
509 * The move will start & end when the animation begins & ends.
510 * @param [in] actor The actor to animate.
511 * @param [in] x axis displacement.
512 * @param [in] y axis displacement.
513 * @param [in] z axis displacement.
515 void MoveBy(Actor actor, float x, float y, float z);
518 * @brief Move an actor relative to its position.
520 * This overload allows the alpha function to be customized.
521 * The move will start & end when the animation begins & ends.
522 * @param [in] actor The actor to animate.
523 * @param [in] displacement relative to current position.
524 * @param [in] alpha The alpha function to apply.
526 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
529 * @brief Move an actor relative to its position.
531 * This overload allows the translation start & end time to be customized.
532 * @pre delaySeconds must be zero or greater.
533 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
534 * @param [in] actor The actor to animate.
535 * @param [in] displacement relative to current position.
536 * @param [in] alpha The alpha function to apply.
537 * @param [in] delaySeconds The initial delay from the start of the animation.
538 * @param [in] durationSeconds The duration of the translation.
540 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
543 * @brief Move an actor to a target position.
545 * The default alpha function will be used.
546 * The move will start & end when the animation begins & ends.
547 * @param [in] actor The actor to animate.
548 * @param [in] x axis position.
549 * @param [in] y axis position.
550 * @param [in] z axis position.
552 void MoveTo(Actor actor, float x, float y, float z);
555 * @brief Move an actor to a target position.
557 * This overload allows the alpha function to be customized.
558 * The move will start & end when the animation begins & ends.
559 * @param [in] actor The actor to animate.
560 * @param [in] position to move to
561 * @param [in] alpha The alpha function to apply.
563 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
566 * @brief Move an actor to a target position.
568 * This overload allows the translation start & end time to be customized.
569 * @pre delaySeconds must be zero or greater.
570 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
571 * @param [in] actor The actor to animate.
572 * @param [in] position to move to
573 * @param [in] alpha The alpha function to apply.
574 * @param [in] delaySeconds The initial delay from the start of the animation.
575 * @param [in] durationSeconds The duration of the translation.
577 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
580 * @brief Move an actor using a custom function.
582 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
583 * @pre delaySeconds must be zero or greater.
584 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
585 * @param [in] actor The actor to animate.
586 * @param [in] animatorFunc The function to call during the animation.
587 * @param [in] alpha The alpha function to apply.
588 * @param [in] delaySeconds The initial delay from the start of the animation.
589 * @param [in] durationSeconds The duration of the translation.
591 void Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
594 * @brief Rotate an actor around an arbitrary axis.
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 degrees.
600 * @param [in] axis The axis to rotate around
602 void RotateBy(Actor actor, Degree angle, Vector3 axis);
605 * @brief Rotate an actor around an arbitrary axis.
607 * The default alpha function will be used.
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
613 void RotateBy(Actor actor, Radian angle, Vector3 axis);
616 * @brief Rotate an actor around an arbitrary axis.
618 * This overload allows the alpha function to be customized.
619 * The rotation will start & end when the animation begins & ends.
620 * @param [in] actor The actor to animate.
621 * @param [in] angle The angle in radians.
622 * @param [in] axis The axis to rotate around.
623 * @param [in] alpha The alpha function to apply.
625 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
628 * @brief Rotate an actor around an arbitrary axis.
630 * This overload allows the alpha function to be customized.
631 * The rotation will start & end when the animation begins & ends.
632 * @param [in] actor The actor to animate.
633 * @param [in] angle The angle in radians.
634 * @param [in] axis The axis to rotate around.
635 * @param [in] alpha The alpha function to apply.
637 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
640 * @brief Rotate an actor around an arbitrary axis.
642 * This overload allows the rotation start & end time to be customized.
643 * @pre delaySeconds must be zero or greater.
644 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
645 * @param [in] actor The actor to animate.
646 * @param [in] angle The angle in degrees.
647 * @param [in] axis The axis to rotate around
648 * @param [in] alpha The alpha function to apply.
649 * @param [in] delaySeconds The initial delay from the start of the animation.
650 * @param [in] durationSeconds The duration of the rotation.
652 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
655 * @brief Rotate an actor around an arbitrary axis.
657 * This overload allows the rotation start & end time to be customized.
658 * @pre delaySeconds must be zero or greater.
659 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
660 * @param [in] actor The actor to animate.
661 * @param [in] angle The angle in radians.
662 * @param [in] axis The axis to rotate around
663 * @param [in] alpha The alpha function to apply.
664 * @param [in] delaySeconds The initial delay from the start of the animation.
665 * @param [in] durationSeconds The duration of the rotation.
667 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
670 * @brief Rotate an actor to a target orientation.
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 degrees.
676 * @param [in] axis The target axis of rotation.
678 void RotateTo(Actor actor, Degree angle, Vector3 axis);
681 * @brief Rotate an actor to a target orientation.
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] angle The target rotation angle in radians.
687 * @param [in] axis The target axis of rotation.
689 void RotateTo(Actor actor, Radian angle, Vector3 axis);
692 * @brief Rotate an actor to a target orientation.
694 * The default alpha function will be used.
695 * The rotation will start & end when the animation begins & ends.
696 * @param [in] actor The actor to animate.
697 * @param [in] orientation The target orientation.
699 void RotateTo(Actor actor, Quaternion orientation);
702 * @brief Rotate an actor to a target orientation.
704 * This overload allows the alpha function to be customized.
705 * The rotation will start & end when the animation begins & ends.
706 * @param [in] actor The actor to animate.
707 * @param [in] angle The target rotation angle in degrees.
708 * @param [in] axis The target axis of rotation.
709 * @param [in] alpha The alpha function to apply.
711 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
714 * @brief Rotate an actor to a target orientation.
716 * This overload allows the alpha function to be customized.
717 * The rotation will start & end when the animation begins & ends.
718 * @param [in] actor The actor to animate.
719 * @param [in] angle The target rotation angle in radians.
720 * @param [in] axis The target axis of rotation.
721 * @param [in] alpha The alpha function to apply.
723 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
726 * @brief Rotate an actor to a target orientation.
728 * This overload allows the alpha function to be customized.
729 * The rotation will start & end when the animation begins & ends.
730 * @param [in] actor The actor to animate.
731 * @param [in] orientation The target orientation.
732 * @param [in] alpha The alpha function to apply.
734 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
737 * @brief Rotate an actor to a target orientation.
739 * This overload allows the rotation start & end time to be customized.
740 * @pre delaySeconds must be zero or greater.
741 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
742 * @param [in] actor The actor to animate.
743 * @param [in] angle The target rotation angle in degrees.
744 * @param [in] axis The target axis of rotation.
745 * @param [in] alpha The alpha function to apply.
746 * @param [in] delaySeconds The initial delay from the start of the animation.
747 * @param [in] durationSeconds The duration of the rotation.
749 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
752 * @brief Rotate an actor to a target orientation.
754 * This overload allows the rotation start & end time to be customized.
755 * @pre delaySeconds must be zero or greater.
756 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
757 * @param [in] actor The actor to animate.
758 * @param [in] angle The target rotation angle in radians.
759 * @param [in] axis The target axis of rotation.
760 * @param [in] alpha The alpha function to apply.
761 * @param [in] delaySeconds The initial delay from the start of the animation.
762 * @param [in] durationSeconds The duration of the rotation.
764 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
767 * @brief Rotate an actor to a target orientation.
769 * This overload allows the rotation start & end time to be customized.
770 * @pre delaySeconds must be zero or greater.
771 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
772 * @param [in] actor The actor to animate.
773 * @param [in] orientation The target orientation.
774 * @param [in] alpha The alpha function to apply.
775 * @param [in] delaySeconds The initial delay from the start of the animation.
776 * @param [in] durationSeconds The duration of the rotation.
778 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
781 * @brief Rotate an actor using a custom function.
783 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
784 * @pre delaySeconds must be zero or greater.
785 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
786 * @param [in] actor The actor to animate.
787 * @param [in] animatorFunc The function to call during the animation.
788 * @param [in] alpha The alpha function to apply.
789 * @param [in] delaySeconds The initial delay from the start of the animation.
790 * @param [in] durationSeconds The duration of the rotation.
792 void Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
795 * @brief Scale an actor.
797 * The default alpha function will be used.
798 * The scaling will start & end when the animation begins & ends.
799 * @param [in] actor The actor to animate.
800 * @param [in] x Scale factor in the X-direction.
801 * @param [in] y Scale factor in the Y-direction.
802 * @param [in] z Scale factor in the Z-direction.
804 void ScaleBy(Actor actor, float x, float y, float z);
807 * @brief Scale an actor.
809 * This overload allows the alpha function to be customized.
810 * The scaling will start & end when the animation begins & ends.
811 * @param [in] actor The actor to animate.
812 * @param [in] scale The scale factor.
813 * @param [in] alpha The alpha function to apply.
815 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
818 * @brief Scale an actor.
820 * This overload allows the scaling start & end time to be customized.
821 * @pre delaySeconds must be zero or greater.
822 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
823 * @param [in] actor The actor to animate.
824 * @param [in] scale The scale factor.
825 * @param [in] alpha The alpha function to apply.
826 * @param [in] delaySeconds The initial delay from the start of the animation.
827 * @param [in] durationSeconds The duration of the scaling.
829 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
832 * @brief Scale an actor to a target scale factor.
834 * The default alpha function will be used.
835 * The scaling will start & end when the animation begins & ends.
836 * @param [in] actor The actor to animate.
837 * @param [in] x Target scale-factor in the X-direction.
838 * @param [in] y Target scale-factor in the Y-direction.
839 * @param [in] z Target scale-factor in the Z-direction.
841 void ScaleTo(Actor actor, float x, float y, float z);
844 * @brief Scale an actor to a target scale factor.
846 * This overload allows the alpha function to be customized.
847 * The scaling will start & end when the animation begins & ends.
848 * @param [in] actor The actor to animate.
849 * @param [in] scale The target scale factor.
850 * @param [in] alpha The alpha function to apply.
852 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
855 * @brief Scale an actor to a target scale factor.
857 * This overload allows the scaling start & end time to be customized.
858 * @pre delaySeconds must be zero or greater.
859 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
860 * @param [in] actor The actor to animate.
861 * @param [in] scale The target scale factor.
862 * @param [in] alpha The alpha function to apply.
863 * @param [in] delaySeconds The initial delay from the start of the animation.
864 * @param [in] durationSeconds The duration of the scaling.
866 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
869 * @brief Show an actor during the animation.
871 * @param [in] actor The actor to animate.
872 * @param [in] delaySeconds The initial delay from the start of the animation.
874 void Show(Actor actor, float delaySeconds);
877 * @brief Hide an actor during the animation.
879 * @param [in] actor The actor to animate.
880 * @param [in] delaySeconds The initial delay from the start of the animation.
882 void Hide(Actor actor, float delaySeconds);
885 * @brief Animate the opacity of an actor.
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] opacity The relative change in opacity.
892 void OpacityBy(Actor actor, float opacity);
895 * @brief Animate the opacity of an actor.
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] opacity The relative change in opacity.
901 * @param [in] alpha The alpha function to apply.
903 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
906 * @brief Animate the opacity of an actor.
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] opacity The relative change in opacity.
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 opacity animation.
917 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
920 * @brief Animate an actor to a target opacity.
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] opacity The target opacity.
927 void OpacityTo(Actor actor, float opacity);
930 * @brief Animate an actor to a target opacity.
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] opacity The target opacity.
936 * @param [in] alpha The alpha function to apply.
938 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
941 * @brief Animate an actor to a target opacity.
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] opacity The target opacity.
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 opacity animation.
952 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
955 * @brief Animate the color of an actor.
957 * The default alpha function will be used.
958 * The effect will start & end when the animation begins & ends.
959 * @param [in] actor The actor to animate.
960 * @param [in] color The relative change in color.
962 void ColorBy(Actor actor, Vector4 color);
965 * @brief Animate the color of an actor.
967 * This overload allows the alpha function to be customized.
968 * The effect will start & end when the animation begins & ends.
969 * @param [in] actor The actor to animate.
970 * @param [in] color The relative change in color.
971 * @param [in] alpha The alpha function to apply.
973 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
976 * @brief Animate the color of an actor.
978 * This overload allows the animation start & end time to be customized.
979 * @pre delaySeconds must be zero or greater.
980 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
981 * @param [in] actor The actor to animate.
982 * @param [in] color The relative change in color.
983 * @param [in] alpha The alpha function to apply.
984 * @param [in] delaySeconds The initial delay from the start of the animation.
985 * @param [in] durationSeconds The duration of the color animation.
987 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
990 * @brief Animate an actor to a target color.
992 * The default alpha function will be used.
993 * The effect will start & end when the animation begins & ends.
994 * @param [in] actor The actor to animate.
995 * @param [in] color The target color.
997 void ColorTo(Actor actor, Vector4 color);
1000 * @brief Animate an actor to a target color.
1002 * This overload allows the alpha function to be customized.
1003 * The effect will start & end when the animation begins & ends.
1004 * @param [in] actor The actor to animate.
1005 * @param [in] color The target color.
1006 * @param [in] alpha The alpha function to apply.
1008 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
1011 * @brief Animate an actor to a target color.
1013 * This overload allows the animation start & end time to be customized.
1014 * @pre delaySeconds must be zero or greater.
1015 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1016 * @param [in] actor The actor to animate.
1017 * @param [in] color The target color.
1018 * @param [in] alpha The alpha function to apply.
1019 * @param [in] delaySeconds The initial delay from the start of the animation.
1020 * @param [in] durationSeconds The duration of the color animation.
1022 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1025 * @brief Resize an actor.
1027 * The default alpha function will be used.
1028 * The resizing will start & end when the animation begins & ends.
1029 * The depth defaults to the minimum of width & height.
1030 * @param [in] actor The actor to animate.
1031 * @param [in] width The target width.
1032 * @param [in] height The target height.
1034 void Resize(Actor actor, float width, float height);
1037 * @brief Resize an actor.
1039 * This overload allows the alpha function to be customized.
1040 * The resizing will start & end when the animation begins & ends.
1041 * The depth defaults to the minimum of width & height.
1042 * @param [in] actor The actor to animate.
1043 * @param [in] width The target width.
1044 * @param [in] height The target height.
1045 * @param [in] alpha The alpha function to apply.
1047 void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1050 * @brief Resize an actor.
1052 * This overload allows the resizing start & end time to be customized.
1053 * The depth defaults to the minimum of width & height.
1054 * @pre delaySeconds must be zero or greater.
1055 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1056 * @param [in] actor The actor to animate.
1057 * @param [in] width The target width.
1058 * @param [in] height The target height.
1059 * @param [in] alpha The alpha function to apply.
1060 * @param [in] delaySeconds The initial delay from the start of the animation.
1061 * @param [in] durationSeconds The duration of the resizing.
1063 void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1066 * @brief Resize an actor.
1068 * The default alpha function will be used.
1069 * The resizing will start & end when the animation begins & ends.
1070 * @param [in] actor The actor to animate.
1071 * @param [in] size The target size.
1073 void Resize(Actor actor, Vector3 size);
1076 * @brief Resize an actor.
1078 * This overload allows the alpha function to be customized.
1079 * The resizing will start & end when the animation begins & ends.
1080 * @param [in] actor The actor to animate.
1081 * @param [in] size The target size.
1082 * @param [in] alpha The alpha function to apply.
1084 void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1087 * @brief Resize an actor.
1089 * This overload allows the resizing start & end time to be customized.
1090 * @pre delaySeconds must be zero or greater.
1091 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1092 * @param [in] actor The actor to animate.
1093 * @param [in] size The target size.
1094 * @param [in] alpha The alpha function to apply.
1095 * @param [in] delaySeconds The initial delay from the start of the animation.
1096 * @param [in] durationSeconds The duration of the resizing.
1098 void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1100 public: // Not intended for use by Application developers
1103 * @brief This constructor is used by Dali New() methods
1104 * @param [in] animation A pointer to a newly allocated Dali resource
1106 explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1111 * @brief Animate a property using a custom function.
1113 * @pre The property type is equal expectedType.
1114 * @param [in] target The target object/property to animate.
1115 * @param [in] targetType The expected type of the property.
1116 * @param [in] func The function to call during the animation.
1118 void Animate( Property target,
1119 Property::Type targetType,
1123 * @brief Animate a property using a custom function.
1125 * @pre The property type is equal expectedType.
1126 * @param [in] target The target object/property to animate.
1127 * @param [in] targetType The expected type of the property.
1128 * @param [in] func The function to call during the animation.
1129 * @param [in] alpha The alpha function to apply.
1131 void Animate( Property target,
1132 Property::Type targetType,
1134 AlphaFunction alpha );
1137 * @brief Animate a property using a custom function.
1139 * @pre The property type is equal expectedType.
1140 * @param [in] target The target object/property to animate.
1141 * @param [in] targetType The expected type of the property.
1142 * @param [in] func The function to call during the animation.
1143 * @param [in] period The effect will occur during this time period.
1145 void Animate( Property target,
1146 Property::Type targetType,
1148 TimePeriod period );
1151 * @brief Animate a property using a custom function.
1153 * @pre The property type is equal expectedType.
1154 * @param [in] target The target object/property to animate.
1155 * @param [in] targetType The expected type of the property.
1156 * @param [in] func The function to call during the animation.
1157 * @param [in] alpha The alpha function to apply.
1158 * @param [in] period The effect will occur during this time period.
1160 void Animate( Property target,
1161 Property::Type targetType,
1163 AlphaFunction alpha,
1164 TimePeriod period );
1169 #endif // __DALI_ANIMATION_H__