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 Specifies an speed factor for the animation.
287 * The speed factor is a multiplier of the normal velocity of the animation. Values between [0,1] will
288 * slow down the animation and values above one will speed up the animation. It is also possible to specify a negative multiplier
289 * to play the animation in reverse.
291 * @param[in] factor A value which will multiply the velocity.
293 void SetSpeedFactor( float factor );
296 * @brief Retrieve the speed factor of the animation
298 * @return speed factor
300 float GetSpeedFactor() const;
303 * @brief Sets the progress of the animation.
304 * The animation will play (or continue playing) from this point
306 * @param[in] progress The new progress as a normalized value between [0,1].
308 void SetCurrentProgress( float progress );
311 * @brief Play the animation.
316 * @brief Play the animation from a given point.
317 * @param[in] progress A value between [0,1] form where the animation should start playing
319 void PlayFrom( float progress );
322 * @brief Pause the animation.
327 * @brief Stop the animation.
332 * @brief Clear the animation.
334 * This disconnects any objects that were being animated, effectively stopping the animation.
339 * @brief Connect to this signal to be notified when an Animation's animations have finished.
341 * @return A signal object to Connect() with.
343 AnimationSignalV2& FinishedSignal();
346 * @brief Animate a property value by a relative amount.
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.
353 void AnimateBy(Property target, Property::Value relativeValue);
356 * @brief Animate a property value by a relative amount.
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.
363 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
366 * @brief Animate a property value by a relative amount.
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.
373 void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
376 * @brief Animate a property value by a relative amount.
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.
383 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
386 * @brief Animate a property to a destination value.
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.
393 void AnimateTo(Property target, Property::Value destinationValue);
396 * @brief Animate a property to a destination value.
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.
403 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
406 * @brief Animate a property to a destination value.
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.
413 void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
416 * @brief Animate a property to a destination value.
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.
423 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
426 * @brief Animate a property between keyframes.
428 * @param [in] target The target object/property to animate.
429 * @param [in] keyFrames The key frames
431 void AnimateBetween(Property target, KeyFrames& keyFrames);
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.
440 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
443 * @brief Animate a property between keyframes.
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.
449 void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
452 * @brief Animate a property between keyframes.
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.
459 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
462 * @brief Animate a property using a custom function.
464 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
465 * @pre The property type is equal PropertyTypes::Get<P>().
466 * @param [in] target The target object/property to animate.
467 * @param [in] animatorFunc The function to call during the animation.
470 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc )
472 Animate( target, PropertyTypes::Get<P>(), animatorFunc );
476 * @brief Animate a property using a custom function.
478 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
479 * @pre The property type is equal PropertyTypes::Get<P>().
480 * @param [in] target The target object/property to animate.
481 * @param [in] animatorFunc The function to call during the animation.
482 * @param [in] alpha The alpha function to apply.
485 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha )
487 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha );
491 * @brief Animate a property using a custom function.
493 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
494 * @pre The property type is equal PropertyTypes::Get<P>().
495 * @param [in] target The target object/property to animate.
496 * @param [in] animatorFunc The function to call during the animation.
497 * @param [in] period The effect will occur during this time period.
500 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, TimePeriod period )
502 Animate( target, PropertyTypes::Get<P>(), animatorFunc, period );
506 * @brief Animate a property using a custom function.
508 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
509 * @pre The property type is equal PropertyTypes::Get<P>().
510 * @param [in] target The target object/property to animate.
511 * @param [in] animatorFunc The function to call during the animation.
512 * @param [in] alpha The alpha function to apply.
513 * @param [in] period The effect will occur during this time period.
516 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha, TimePeriod period )
518 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha, period );
521 // Actor-specific convenience methods
524 * @brief Move an actor relative to its position.
526 * The default alpha function will be used.
527 * The move will start & end when the animation begins & ends.
528 * @param [in] actor The actor to animate.
529 * @param [in] x axis displacement.
530 * @param [in] y axis displacement.
531 * @param [in] z axis displacement.
533 void MoveBy(Actor actor, float x, float y, float z);
536 * @brief Move an actor relative to its position.
538 * This overload allows the alpha function to be customized.
539 * The move will start & end when the animation begins & ends.
540 * @param [in] actor The actor to animate.
541 * @param [in] displacement relative to current position.
542 * @param [in] alpha The alpha function to apply.
544 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
547 * @brief Move an actor relative to its position.
549 * This overload allows the translation start & end time to be customized.
550 * @pre delaySeconds must be zero or greater.
551 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
552 * @param [in] actor The actor to animate.
553 * @param [in] displacement relative to current position.
554 * @param [in] alpha The alpha function to apply.
555 * @param [in] delaySeconds The initial delay from the start of the animation.
556 * @param [in] durationSeconds The duration of the translation.
558 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
561 * @brief Move an actor to a target position.
563 * The default alpha function will be used.
564 * The move will start & end when the animation begins & ends.
565 * @param [in] actor The actor to animate.
566 * @param [in] x axis position.
567 * @param [in] y axis position.
568 * @param [in] z axis position.
570 void MoveTo(Actor actor, float x, float y, float z);
573 * @brief Move an actor to a target position.
575 * This overload allows the alpha function to be customized.
576 * The move will start & end when the animation begins & ends.
577 * @param [in] actor The actor to animate.
578 * @param [in] position to move to
579 * @param [in] alpha The alpha function to apply.
581 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
584 * @brief Move an actor to a target position.
586 * This overload allows the translation 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] position to move to
591 * @param [in] alpha The alpha function to apply.
592 * @param [in] delaySeconds The initial delay from the start of the animation.
593 * @param [in] durationSeconds The duration of the translation.
595 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
598 * @brief Move an actor using a custom function.
600 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
601 * @pre delaySeconds must be zero or greater.
602 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
603 * @param [in] actor The actor to animate.
604 * @param [in] animatorFunc The function to call during the animation.
605 * @param [in] alpha The alpha function to apply.
606 * @param [in] delaySeconds The initial delay from the start of the animation.
607 * @param [in] durationSeconds The duration of the translation.
609 void Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
612 * @brief Rotate an actor around an arbitrary axis.
614 * The default alpha function will be used.
615 * The rotation will start & end when the animation begins & ends.
616 * @param [in] actor The actor to animate.
617 * @param [in] angle The angle in degrees.
618 * @param [in] axis The axis to rotate around
620 void RotateBy(Actor actor, Degree angle, Vector3 axis);
623 * @brief Rotate an actor around an arbitrary axis.
625 * The default alpha function will be used.
626 * The rotation will start & end when the animation begins & ends.
627 * @param [in] actor The actor to animate.
628 * @param [in] angle The angle in radians.
629 * @param [in] axis The axis to rotate around
631 void RotateBy(Actor actor, Radian angle, Vector3 axis);
634 * @brief Rotate an actor around an arbitrary axis.
636 * This overload allows the alpha function to be customized.
637 * The rotation will start & end when the animation begins & ends.
638 * @param [in] actor The actor to animate.
639 * @param [in] angle The angle in radians.
640 * @param [in] axis The axis to rotate around.
641 * @param [in] alpha The alpha function to apply.
643 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
646 * @brief Rotate an actor around an arbitrary axis.
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 angle in radians.
652 * @param [in] axis The axis to rotate around.
653 * @param [in] alpha The alpha function to apply.
655 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
658 * @brief Rotate an actor around an arbitrary axis.
660 * This overload allows the rotation start & end time to be customized.
661 * @pre delaySeconds must be zero or greater.
662 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
663 * @param [in] actor The actor to animate.
664 * @param [in] angle The angle in degrees.
665 * @param [in] axis The axis to rotate around
666 * @param [in] alpha The alpha function to apply.
667 * @param [in] delaySeconds The initial delay from the start of the animation.
668 * @param [in] durationSeconds The duration of the rotation.
670 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
673 * @brief Rotate an actor around an arbitrary axis.
675 * This overload allows the rotation start & end time to be customized.
676 * @pre delaySeconds must be zero or greater.
677 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
678 * @param [in] actor The actor to animate.
679 * @param [in] angle The angle in radians.
680 * @param [in] axis The axis to rotate around
681 * @param [in] alpha The alpha function to apply.
682 * @param [in] delaySeconds The initial delay from the start of the animation.
683 * @param [in] durationSeconds The duration of the rotation.
685 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
688 * @brief Rotate an actor to a target orientation.
690 * The default alpha function will be used.
691 * The rotation will start & end when the animation begins & ends.
692 * @param [in] actor The actor to animate.
693 * @param [in] angle The target rotation angle in degrees.
694 * @param [in] axis The target axis of rotation.
696 void RotateTo(Actor actor, Degree angle, Vector3 axis);
699 * @brief Rotate an actor to a target orientation.
701 * The default alpha function will be used.
702 * The rotation will start & end when the animation begins & ends.
703 * @param [in] actor The actor to animate.
704 * @param [in] angle The target rotation angle in radians.
705 * @param [in] axis The target axis of rotation.
707 void RotateTo(Actor actor, Radian angle, Vector3 axis);
710 * @brief Rotate an actor to a target orientation.
712 * The default alpha function will be used.
713 * The rotation will start & end when the animation begins & ends.
714 * @param [in] actor The actor to animate.
715 * @param [in] orientation The target orientation.
717 void RotateTo(Actor actor, Quaternion orientation);
720 * @brief Rotate an actor to a target orientation.
722 * This overload allows the alpha function to be customized.
723 * The rotation will start & end when the animation begins & ends.
724 * @param [in] actor The actor to animate.
725 * @param [in] angle The target rotation angle in degrees.
726 * @param [in] axis The target axis of rotation.
727 * @param [in] alpha The alpha function to apply.
729 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
732 * @brief Rotate an actor to a target orientation.
734 * This overload allows the alpha function to be customized.
735 * The rotation will start & end when the animation begins & ends.
736 * @param [in] actor The actor to animate.
737 * @param [in] angle The target rotation angle in radians.
738 * @param [in] axis The target axis of rotation.
739 * @param [in] alpha The alpha function to apply.
741 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
744 * @brief Rotate an actor to a target orientation.
746 * This overload allows the alpha function to be customized.
747 * The rotation will start & end when the animation begins & ends.
748 * @param [in] actor The actor to animate.
749 * @param [in] orientation The target orientation.
750 * @param [in] alpha The alpha function to apply.
752 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
755 * @brief Rotate an actor to a target orientation.
757 * This overload allows the rotation start & end time to be customized.
758 * @pre delaySeconds must be zero or greater.
759 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
760 * @param [in] actor The actor to animate.
761 * @param [in] angle The target rotation angle in degrees.
762 * @param [in] axis The target axis of rotation.
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.
767 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
770 * @brief Rotate an actor to a target orientation.
772 * This overload allows the rotation start & end time to be customized.
773 * @pre delaySeconds must be zero or greater.
774 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
775 * @param [in] actor The actor to animate.
776 * @param [in] angle The target rotation angle in radians.
777 * @param [in] axis The target axis of rotation.
778 * @param [in] alpha The alpha function to apply.
779 * @param [in] delaySeconds The initial delay from the start of the animation.
780 * @param [in] durationSeconds The duration of the rotation.
782 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
785 * @brief Rotate an actor to a target orientation.
787 * This overload allows the rotation 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] orientation The target orientation.
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 rotation.
796 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
799 * @brief Rotate an actor using a custom function.
801 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
802 * @pre delaySeconds must be zero or greater.
803 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
804 * @param [in] actor The actor to animate.
805 * @param [in] animatorFunc The function to call during the animation.
806 * @param [in] alpha The alpha function to apply.
807 * @param [in] delaySeconds The initial delay from the start of the animation.
808 * @param [in] durationSeconds The duration of the rotation.
810 void Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
813 * @brief Scale an actor.
815 * The default alpha function will be used.
816 * The scaling will start & end when the animation begins & ends.
817 * @param [in] actor The actor to animate.
818 * @param [in] x Scale factor in the X-direction.
819 * @param [in] y Scale factor in the Y-direction.
820 * @param [in] z Scale factor in the Z-direction.
822 void ScaleBy(Actor actor, float x, float y, float z);
825 * @brief Scale an actor.
827 * This overload allows the alpha function to be customized.
828 * The scaling will start & end when the animation begins & ends.
829 * @param [in] actor The actor to animate.
830 * @param [in] scale The scale factor.
831 * @param [in] alpha The alpha function to apply.
833 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
836 * @brief Scale an actor.
838 * This overload allows the scaling 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] scale The scale factor.
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 scaling.
847 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
850 * @brief Scale an actor to a target scale factor.
852 * The default alpha function will be used.
853 * The scaling will start & end when the animation begins & ends.
854 * @param [in] actor The actor to animate.
855 * @param [in] x Target scale-factor in the X-direction.
856 * @param [in] y Target scale-factor in the Y-direction.
857 * @param [in] z Target scale-factor in the Z-direction.
859 void ScaleTo(Actor actor, float x, float y, float z);
862 * @brief Scale an actor to a target scale factor.
864 * This overload allows the alpha function to be customized.
865 * The scaling will start & end when the animation begins & ends.
866 * @param [in] actor The actor to animate.
867 * @param [in] scale The target scale factor.
868 * @param [in] alpha The alpha function to apply.
870 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
873 * @brief Scale an actor to a target scale factor.
875 * This overload allows the scaling start & end time to be customized.
876 * @pre delaySeconds must be zero or greater.
877 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
878 * @param [in] actor The actor to animate.
879 * @param [in] scale The target scale factor.
880 * @param [in] alpha The alpha function to apply.
881 * @param [in] delaySeconds The initial delay from the start of the animation.
882 * @param [in] durationSeconds The duration of the scaling.
884 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
887 * @brief Show an actor during the animation.
889 * @param [in] actor The actor to animate.
890 * @param [in] delaySeconds The initial delay from the start of the animation.
892 void Show(Actor actor, float delaySeconds);
895 * @brief Hide an actor during the animation.
897 * @param [in] actor The actor to animate.
898 * @param [in] delaySeconds The initial delay from the start of the animation.
900 void Hide(Actor actor, float delaySeconds);
903 * @brief Animate the opacity of an actor.
905 * The default alpha function will be used.
906 * The effect will start & end when the animation begins & ends.
907 * @param [in] actor The actor to animate.
908 * @param [in] opacity The relative change in opacity.
910 void OpacityBy(Actor actor, float opacity);
913 * @brief Animate the opacity of an actor.
915 * This overload allows the alpha function to be customized.
916 * The effect will start & end when the animation begins & ends.
917 * @param [in] actor The actor to animate.
918 * @param [in] opacity The relative change in opacity.
919 * @param [in] alpha The alpha function to apply.
921 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
924 * @brief Animate the opacity of an actor.
926 * This overload allows the animation start & end time to be customized.
927 * @pre delaySeconds must be zero or greater.
928 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
929 * @param [in] actor The actor to animate.
930 * @param [in] opacity The relative change in opacity.
931 * @param [in] alpha The alpha function to apply.
932 * @param [in] delaySeconds The initial delay from the start of the animation.
933 * @param [in] durationSeconds The duration of the opacity animation.
935 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
938 * @brief Animate an actor to a target opacity.
940 * The default alpha function will be used.
941 * The effect will start & end when the animation begins & ends.
942 * @param [in] actor The actor to animate.
943 * @param [in] opacity The target opacity.
945 void OpacityTo(Actor actor, float opacity);
948 * @brief Animate an actor to a target opacity.
950 * This overload allows the alpha function to be customized.
951 * The effect will start & end when the animation begins & ends.
952 * @param [in] actor The actor to animate.
953 * @param [in] opacity The target opacity.
954 * @param [in] alpha The alpha function to apply.
956 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
959 * @brief Animate an actor to a target opacity.
961 * This overload allows the animation start & end time to be customized.
962 * @pre delaySeconds must be zero or greater.
963 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
964 * @param [in] actor The actor to animate.
965 * @param [in] opacity The target opacity.
966 * @param [in] alpha The alpha function to apply.
967 * @param [in] delaySeconds The initial delay from the start of the animation.
968 * @param [in] durationSeconds The duration of the opacity animation.
970 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
973 * @brief Animate the color of an actor.
975 * The default alpha function will be used.
976 * The effect will start & end when the animation begins & ends.
977 * @param [in] actor The actor to animate.
978 * @param [in] color The relative change in color.
980 void ColorBy(Actor actor, Vector4 color);
983 * @brief Animate the color of an actor.
985 * This overload allows the alpha function to be customized.
986 * The effect will start & end when the animation begins & ends.
987 * @param [in] actor The actor to animate.
988 * @param [in] color The relative change in color.
989 * @param [in] alpha The alpha function to apply.
991 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
994 * @brief Animate the color of an actor.
996 * This overload allows the animation start & end time to be customized.
997 * @pre delaySeconds must be zero or greater.
998 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
999 * @param [in] actor The actor to animate.
1000 * @param [in] color The relative change in color.
1001 * @param [in] alpha The alpha function to apply.
1002 * @param [in] delaySeconds The initial delay from the start of the animation.
1003 * @param [in] durationSeconds The duration of the color animation.
1005 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1008 * @brief Animate an actor to a target color.
1010 * The default alpha function will be used.
1011 * The effect will start & end when the animation begins & ends.
1012 * @param [in] actor The actor to animate.
1013 * @param [in] color The target color.
1015 void ColorTo(Actor actor, Vector4 color);
1018 * @brief Animate an actor to a target color.
1020 * This overload allows the alpha function to be customized.
1021 * The effect will start & end when the animation begins & ends.
1022 * @param [in] actor The actor to animate.
1023 * @param [in] color The target color.
1024 * @param [in] alpha The alpha function to apply.
1026 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
1029 * @brief Animate an actor to a target color.
1031 * This overload allows the animation start & end time to be customized.
1032 * @pre delaySeconds must be zero or greater.
1033 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1034 * @param [in] actor The actor to animate.
1035 * @param [in] color The target color.
1036 * @param [in] alpha The alpha function to apply.
1037 * @param [in] delaySeconds The initial delay from the start of the animation.
1038 * @param [in] durationSeconds The duration of the color animation.
1040 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1043 * @brief Resize an actor.
1045 * The default alpha function will be used.
1046 * The resizing will start & end when the animation begins & ends.
1047 * The depth defaults to the minimum of width & height.
1048 * @param [in] actor The actor to animate.
1049 * @param [in] width The target width.
1050 * @param [in] height The target height.
1052 void Resize(Actor actor, float width, float height);
1055 * @brief Resize an actor.
1057 * This overload allows the alpha function to be customized.
1058 * The resizing will start & end when the animation begins & ends.
1059 * The depth defaults to the minimum of width & height.
1060 * @param [in] actor The actor to animate.
1061 * @param [in] width The target width.
1062 * @param [in] height The target height.
1063 * @param [in] alpha The alpha function to apply.
1065 void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1068 * @brief Resize an actor.
1070 * This overload allows the resizing start & end time to be customized.
1071 * The depth defaults to the minimum of width & height.
1072 * @pre delaySeconds must be zero or greater.
1073 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1074 * @param [in] actor The actor to animate.
1075 * @param [in] width The target width.
1076 * @param [in] height The target height.
1077 * @param [in] alpha The alpha function to apply.
1078 * @param [in] delaySeconds The initial delay from the start of the animation.
1079 * @param [in] durationSeconds The duration of the resizing.
1081 void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1084 * @brief Resize an actor.
1086 * The default alpha function will be used.
1087 * The resizing will start & end when the animation begins & ends.
1088 * @param [in] actor The actor to animate.
1089 * @param [in] size The target size.
1091 void Resize(Actor actor, Vector3 size);
1094 * @brief Resize an actor.
1096 * This overload allows the alpha function to be customized.
1097 * The resizing will start & end when the animation begins & ends.
1098 * @param [in] actor The actor to animate.
1099 * @param [in] size The target size.
1100 * @param [in] alpha The alpha function to apply.
1102 void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1105 * @brief Resize an actor.
1107 * This overload allows the resizing start & end time to be customized.
1108 * @pre delaySeconds must be zero or greater.
1109 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1110 * @param [in] actor The actor to animate.
1111 * @param [in] size The target size.
1112 * @param [in] alpha The alpha function to apply.
1113 * @param [in] delaySeconds The initial delay from the start of the animation.
1114 * @param [in] durationSeconds The duration of the resizing.
1116 void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1118 public: // Not intended for use by Application developers
1121 * @brief This constructor is used by Dali New() methods
1122 * @param [in] animation A pointer to a newly allocated Dali resource
1124 explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1129 * @brief Animate a property using a custom function.
1131 * @pre The property type is equal expectedType.
1132 * @param [in] target The target object/property to animate.
1133 * @param [in] targetType The expected type of the property.
1134 * @param [in] func The function to call during the animation.
1136 void Animate( Property target,
1137 Property::Type targetType,
1141 * @brief Animate a property using a custom function.
1143 * @pre The property type is equal expectedType.
1144 * @param [in] target The target object/property to animate.
1145 * @param [in] targetType The expected type of the property.
1146 * @param [in] func The function to call during the animation.
1147 * @param [in] alpha The alpha function to apply.
1149 void Animate( Property target,
1150 Property::Type targetType,
1152 AlphaFunction alpha );
1155 * @brief Animate a property using a custom function.
1157 * @pre The property type is equal expectedType.
1158 * @param [in] target The target object/property to animate.
1159 * @param [in] targetType The expected type of the property.
1160 * @param [in] func The function to call during the animation.
1161 * @param [in] period The effect will occur during this time period.
1163 void Animate( Property target,
1164 Property::Type targetType,
1166 TimePeriod period );
1169 * @brief Animate a property using a custom function.
1171 * @pre The property type is equal expectedType.
1172 * @param [in] target The target object/property to animate.
1173 * @param [in] targetType The expected type of the property.
1174 * @param [in] func The function to call during the animation.
1175 * @param [in] alpha The alpha function to apply.
1176 * @param [in] period The effect will occur during this time period.
1178 void Animate( Property target,
1179 Property::Type targetType,
1181 AlphaFunction alpha,
1182 TimePeriod period );
1187 #endif // __DALI_ANIMATION_H__