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 or if it is stopped.
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;
249 * @param[in] action The destroy action.
251 * @deprecated Use SetEndAction
253 void SetDestroyAction(EndAction action);
258 * @return The destroy action.
260 * @deprecated Use GetEndAction
262 EndAction GetDestroyAction() const;
265 * @brief Set the disconnect action.
267 * If any of the animated property owners are disconnected from the stage, then this action is performed.
268 * Default action is to BakeFinal.
269 * @param[in] disconnectAction The disconnect action.
271 void SetDisconnectAction( EndAction disconnectAction );
274 * @brief Returns the disconnect action.
276 * @return The disconnect action.
278 EndAction GetDisconnectAction() const;
281 * @brief Set the default alpha function for an animation.
283 * This is applied to individual property animations, if no further alpha functions are supplied.
284 * @param[in] alpha The default alpha function.
286 void SetDefaultAlphaFunction(AlphaFunction alpha);
289 * @brief Retrieve the default alpha function for an animation.
291 * @return The default alpha function.
293 AlphaFunction GetDefaultAlphaFunction() const;
296 * @brief Sets the progress of the animation.
297 * The animation will play (or continue playing) from this point. The progress
298 * must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
299 * otherwise, it will be ignored.
301 * @param[in] progress The new progress as a normalized value between [0,1] or between the
302 * play range if specified.
304 void SetCurrentProgress( float progress );
307 * @brief Retrieve the current progress of the animation.
309 * @return The current progress as a normalized value between [0,1].
311 float GetCurrentProgress();
314 * @brief Specifies an speed factor for the animation.
316 * The speed factor is a multiplier of the normal velocity of the animation. Values between [0,1] will
317 * slow down the animation and values above one will speed up the animation. It is also possible to specify a negative multiplier
318 * to play the animation in reverse.
320 * @param[in] factor A value which will multiply the velocity.
322 void SetSpeedFactor( float factor );
325 * @brief Retrieve the speed factor of the animation
327 * @return speed factor
329 float GetSpeedFactor() const;
332 * @brief Set the playing range.
333 * Animation will play between the values specified. Both values ( range.x and range.y ) should be between 0-1,
334 * otherwise they will be ignored. If the range provided is not in proper order ( minimum,maximum ), it will be reordered.
336 * @param[in] range Two values between [0,1] to specify minimum and maximum progress. The
337 * animation will play between those values.
339 void SetPlayRange( const Vector2& range );
342 * @brief Get the playing range
344 * @return The play range defined for the animation.
346 Vector2 GetPlayRange() const;
349 * @brief Play the animation.
354 * @brief Play the animation from a given point.
355 * The progress must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
356 * otherwise, it will be ignored.
358 * @param[in] progress A value between [0,1], or between the play range if specified, form where the animation should start playing
360 void PlayFrom( float progress );
363 * @brief Pause the animation.
368 * @brief Stop the animation.
373 * @brief Clear the animation.
375 * This disconnects any objects that were being animated, effectively stopping the animation.
380 * @brief Connect to this signal to be notified when an Animation's animations have finished.
382 * @return A signal object to Connect() with.
384 AnimationSignalV2& FinishedSignal();
387 * @brief Animate a property value by a relative amount.
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] relativeValue The property value will change by this amount.
394 void AnimateBy(Property target, Property::Value relativeValue);
397 * @brief Animate a property value by a relative amount.
399 * The effect will start & end when the animation begins & ends.
400 * @param [in] target The target object/property to animate.
401 * @param [in] relativeValue The property value will change by this amount.
402 * @param [in] alpha The alpha function to apply.
404 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
407 * @brief Animate a property value by a relative amount.
409 * The default alpha function will be used.
410 * @param [in] target The target object/property to animate.
411 * @param [in] relativeValue The property value will increase/decrease by this amount.
412 * @param [in] period The effect will occur during this time period.
414 void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
417 * @brief Animate a property value by a relative amount.
419 * @param [in] target The target object/property to animate.
420 * @param [in] relativeValue The property value will increase/decrease by this amount.
421 * @param [in] alpha The alpha function to apply.
422 * @param [in] period The effect will occur during this time period.
424 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
427 * @brief Animate a property to a destination value.
429 * The default alpha function will be used.
430 * The effect will start & end when the animation begins & ends.
431 * @param [in] target The target object/property to animate.
432 * @param [in] destinationValue The destination value.
434 void AnimateTo(Property target, Property::Value destinationValue);
437 * @brief Animate a property to a destination value.
439 * The effect will start & end when the animation begins & ends.
440 * @param [in] target The target object/property to animate.
441 * @param [in] destinationValue The destination value.
442 * @param [in] alpha The alpha function to apply.
444 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
447 * @brief Animate a property to a destination value.
449 * The default alpha function will be used.
450 * @param [in] target The target object/property to animate.
451 * @param [in] destinationValue The destination value.
452 * @param [in] period The effect will occur during this time period.
454 void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
457 * @brief Animate a property to a destination value.
459 * @param [in] target The target object/property to animate.
460 * @param [in] destinationValue The destination value.
461 * @param [in] alpha The alpha function to apply.
462 * @param [in] period The effect will occur during this time period.
464 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
467 * @brief Animate a property between keyframes.
469 * @param [in] target The target object/property to animate.
470 * @param [in] keyFrames The key frames
472 void AnimateBetween(Property target, KeyFrames& keyFrames);
475 * @brief Animate a property between keyframes.
477 * @param [in] target The target object/property to animate.
478 * @param [in] keyFrames The key frames
479 * @param [in] alpha The alpha function to apply.
481 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
484 * @brief Animate a property between keyframes.
486 * @param [in] target The target object/property to animate.
487 * @param [in] keyFrames The key frames
488 * @param [in] period The effect will occur during this time period.
490 void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
493 * @brief Animate a property between keyframes.
495 * @param [in] target The target object/property to animate.
496 * @param [in] keyFrames The key frames
497 * @param [in] alpha The alpha function to apply.
498 * @param [in] period The effect will occur during this time period.
500 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
503 * @brief Animate a property using a custom function.
505 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
506 * @pre The property type is equal PropertyTypes::Get<P>().
507 * @param [in] target The target object/property to animate.
508 * @param [in] animatorFunc The function to call during the animation.
511 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc )
513 Animate( target, PropertyTypes::Get<P>(), animatorFunc );
517 * @brief Animate a property using a custom function.
519 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
520 * @pre The property type is equal PropertyTypes::Get<P>().
521 * @param [in] target The target object/property to animate.
522 * @param [in] animatorFunc The function to call during the animation.
523 * @param [in] alpha The alpha function to apply.
526 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha )
528 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha );
532 * @brief Animate a property using a custom function.
534 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
535 * @pre The property type is equal PropertyTypes::Get<P>().
536 * @param [in] target The target object/property to animate.
537 * @param [in] animatorFunc The function to call during the animation.
538 * @param [in] period The effect will occur during this time period.
541 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, TimePeriod period )
543 Animate( target, PropertyTypes::Get<P>(), animatorFunc, period );
547 * @brief Animate a property using a custom function.
549 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
550 * @pre The property type is equal PropertyTypes::Get<P>().
551 * @param [in] target The target object/property to animate.
552 * @param [in] animatorFunc The function to call during the animation.
553 * @param [in] alpha The alpha function to apply.
554 * @param [in] period The effect will occur during this time period.
557 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha, TimePeriod period )
559 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha, period );
562 // Actor-specific convenience methods
565 * @brief Move an actor relative to its position.
567 * The default alpha function will be used.
568 * The move will start & end when the animation begins & ends.
569 * @param [in] actor The actor to animate.
570 * @param [in] x axis displacement.
571 * @param [in] y axis displacement.
572 * @param [in] z axis displacement.
574 void MoveBy(Actor actor, float x, float y, float z);
577 * @brief Move an actor relative to its position.
579 * This overload allows the alpha function to be customized.
580 * The move will start & end when the animation begins & ends.
581 * @param [in] actor The actor to animate.
582 * @param [in] displacement relative to current position.
583 * @param [in] alpha The alpha function to apply.
585 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
588 * @brief Move an actor relative to its position.
590 * This overload allows the translation start & end time to be customized.
591 * @pre delaySeconds must be zero or greater.
592 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
593 * @param [in] actor The actor to animate.
594 * @param [in] displacement relative to current position.
595 * @param [in] alpha The alpha function to apply.
596 * @param [in] delaySeconds The initial delay from the start of the animation.
597 * @param [in] durationSeconds The duration of the translation.
599 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
602 * @brief Move an actor to a target position.
604 * The default alpha function will be used.
605 * The move will start & end when the animation begins & ends.
606 * @param [in] actor The actor to animate.
607 * @param [in] x axis position.
608 * @param [in] y axis position.
609 * @param [in] z axis position.
611 void MoveTo(Actor actor, float x, float y, float z);
614 * @brief Move an actor to a target position.
616 * This overload allows the alpha function to be customized.
617 * The move will start & end when the animation begins & ends.
618 * @param [in] actor The actor to animate.
619 * @param [in] position to move to
620 * @param [in] alpha The alpha function to apply.
622 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
625 * @brief Move an actor to a target position.
627 * This overload allows the translation start & end time to be customized.
628 * @pre delaySeconds must be zero or greater.
629 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
630 * @param [in] actor The actor to animate.
631 * @param [in] position to move to
632 * @param [in] alpha The alpha function to apply.
633 * @param [in] delaySeconds The initial delay from the start of the animation.
634 * @param [in] durationSeconds The duration of the translation.
636 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
639 * @brief Move an actor using a custom function.
641 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
642 * @pre delaySeconds must be zero or greater.
643 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
644 * @param [in] actor The actor to animate.
645 * @param [in] animatorFunc The function to call during the animation.
646 * @param [in] alpha The alpha function to apply.
647 * @param [in] delaySeconds The initial delay from the start of the animation.
648 * @param [in] durationSeconds The duration of the translation.
650 void Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
653 * @brief Rotate an actor around an arbitrary axis.
655 * The default alpha function will be used.
656 * The rotation will start & end when the animation begins & ends.
657 * @param [in] actor The actor to animate.
658 * @param [in] angle The angle in degrees.
659 * @param [in] axis The axis to rotate around
661 void RotateBy(Actor actor, Degree angle, Vector3 axis);
664 * @brief Rotate an actor around an arbitrary axis.
666 * The default alpha function will be used.
667 * The rotation will start & end when the animation begins & ends.
668 * @param [in] actor The actor to animate.
669 * @param [in] angle The angle in radians.
670 * @param [in] axis The axis to rotate around
672 void RotateBy(Actor actor, Radian angle, Vector3 axis);
675 * @brief Rotate an actor around an arbitrary axis.
677 * This overload allows the alpha function to be customized.
678 * The rotation will start & end when the animation begins & ends.
679 * @param [in] actor The actor to animate.
680 * @param [in] angle The angle in radians.
681 * @param [in] axis The axis to rotate around.
682 * @param [in] alpha The alpha function to apply.
684 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
687 * @brief Rotate an actor around an arbitrary axis.
689 * This overload allows the alpha function to be customized.
690 * The rotation will start & end when the animation begins & ends.
691 * @param [in] actor The actor to animate.
692 * @param [in] angle The angle in radians.
693 * @param [in] axis The axis to rotate around.
694 * @param [in] alpha The alpha function to apply.
696 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
699 * @brief Rotate an actor around an arbitrary axis.
701 * This overload allows the rotation start & end time to be customized.
702 * @pre delaySeconds must be zero or greater.
703 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
704 * @param [in] actor The actor to animate.
705 * @param [in] angle The angle in degrees.
706 * @param [in] axis The axis to rotate around
707 * @param [in] alpha The alpha function to apply.
708 * @param [in] delaySeconds The initial delay from the start of the animation.
709 * @param [in] durationSeconds The duration of the rotation.
711 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
714 * @brief Rotate an actor around an arbitrary axis.
716 * This overload allows the rotation start & end time to be customized.
717 * @pre delaySeconds must be zero or greater.
718 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
719 * @param [in] actor The actor to animate.
720 * @param [in] angle The angle in radians.
721 * @param [in] axis The axis to rotate around
722 * @param [in] alpha The alpha function to apply.
723 * @param [in] delaySeconds The initial delay from the start of the animation.
724 * @param [in] durationSeconds The duration of the rotation.
726 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
729 * @brief Rotate an actor to a target orientation.
731 * The default alpha function will be used.
732 * The rotation will start & end when the animation begins & ends.
733 * @param [in] actor The actor to animate.
734 * @param [in] angle The target rotation angle in degrees.
735 * @param [in] axis The target axis of rotation.
737 void RotateTo(Actor actor, Degree angle, Vector3 axis);
740 * @brief Rotate an actor to a target orientation.
742 * The default alpha function will be used.
743 * The rotation will start & end when the animation begins & ends.
744 * @param [in] actor The actor to animate.
745 * @param [in] angle The target rotation angle in radians.
746 * @param [in] axis The target axis of rotation.
748 void RotateTo(Actor actor, Radian angle, Vector3 axis);
751 * @brief Rotate an actor to a target orientation.
753 * The default alpha function will be used.
754 * The rotation will start & end when the animation begins & ends.
755 * @param [in] actor The actor to animate.
756 * @param [in] orientation The target orientation.
758 void RotateTo(Actor actor, Quaternion orientation);
761 * @brief Rotate an actor to a target orientation.
763 * This overload allows the alpha function to be customized.
764 * The rotation will start & end when the animation begins & ends.
765 * @param [in] actor The actor to animate.
766 * @param [in] angle The target rotation angle in degrees.
767 * @param [in] axis The target axis of rotation.
768 * @param [in] alpha The alpha function to apply.
770 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
773 * @brief Rotate an actor to a target orientation.
775 * This overload allows the alpha function to be customized.
776 * The rotation will start & end when the animation begins & ends.
777 * @param [in] actor The actor to animate.
778 * @param [in] angle The target rotation angle in radians.
779 * @param [in] axis The target axis of rotation.
780 * @param [in] alpha The alpha function to apply.
782 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
785 * @brief Rotate an actor to a target orientation.
787 * This overload allows the alpha function to be customized.
788 * The rotation will start & end when the animation begins & ends.
789 * @param [in] actor The actor to animate.
790 * @param [in] orientation The target orientation.
791 * @param [in] alpha The alpha function to apply.
793 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
796 * @brief Rotate an actor to a target orientation.
798 * This overload allows the rotation start & end time to be customized.
799 * @pre delaySeconds must be zero or greater.
800 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
801 * @param [in] actor The actor to animate.
802 * @param [in] angle The target rotation angle in degrees.
803 * @param [in] axis The target axis of rotation.
804 * @param [in] alpha The alpha function to apply.
805 * @param [in] delaySeconds The initial delay from the start of the animation.
806 * @param [in] durationSeconds The duration of the rotation.
808 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
811 * @brief Rotate an actor to a target orientation.
813 * This overload allows the rotation start & end time to be customized.
814 * @pre delaySeconds must be zero or greater.
815 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
816 * @param [in] actor The actor to animate.
817 * @param [in] angle The target rotation angle in radians.
818 * @param [in] axis The target axis of rotation.
819 * @param [in] alpha The alpha function to apply.
820 * @param [in] delaySeconds The initial delay from the start of the animation.
821 * @param [in] durationSeconds The duration of the rotation.
823 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
826 * @brief Rotate an actor to a target orientation.
828 * This overload allows the rotation start & end time to be customized.
829 * @pre delaySeconds must be zero or greater.
830 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
831 * @param [in] actor The actor to animate.
832 * @param [in] orientation The target orientation.
833 * @param [in] alpha The alpha function to apply.
834 * @param [in] delaySeconds The initial delay from the start of the animation.
835 * @param [in] durationSeconds The duration of the rotation.
837 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
840 * @brief Rotate an actor using a custom function.
842 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
843 * @pre delaySeconds must be zero or greater.
844 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
845 * @param [in] actor The actor to animate.
846 * @param [in] animatorFunc The function to call during the animation.
847 * @param [in] alpha The alpha function to apply.
848 * @param [in] delaySeconds The initial delay from the start of the animation.
849 * @param [in] durationSeconds The duration of the rotation.
851 void Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
854 * @brief Scale an actor.
856 * The default alpha function will be used.
857 * The scaling will start & end when the animation begins & ends.
858 * @param [in] actor The actor to animate.
859 * @param [in] x Scale factor in the X-direction.
860 * @param [in] y Scale factor in the Y-direction.
861 * @param [in] z Scale factor in the Z-direction.
863 void ScaleBy(Actor actor, float x, float y, float z);
866 * @brief Scale an actor.
868 * This overload allows the alpha function to be customized.
869 * The scaling will start & end when the animation begins & ends.
870 * @param [in] actor The actor to animate.
871 * @param [in] scale The scale factor.
872 * @param [in] alpha The alpha function to apply.
874 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
877 * @brief Scale an actor.
879 * This overload allows the scaling start & end time to be customized.
880 * @pre delaySeconds must be zero or greater.
881 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
882 * @param [in] actor The actor to animate.
883 * @param [in] scale The scale factor.
884 * @param [in] alpha The alpha function to apply.
885 * @param [in] delaySeconds The initial delay from the start of the animation.
886 * @param [in] durationSeconds The duration of the scaling.
888 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
891 * @brief Scale an actor to a target scale factor.
893 * The default alpha function will be used.
894 * The scaling will start & end when the animation begins & ends.
895 * @param [in] actor The actor to animate.
896 * @param [in] x Target scale-factor in the X-direction.
897 * @param [in] y Target scale-factor in the Y-direction.
898 * @param [in] z Target scale-factor in the Z-direction.
900 void ScaleTo(Actor actor, float x, float y, float z);
903 * @brief Scale an actor to a target scale factor.
905 * This overload allows the alpha function to be customized.
906 * The scaling will start & end when the animation begins & ends.
907 * @param [in] actor The actor to animate.
908 * @param [in] scale The target scale factor.
909 * @param [in] alpha The alpha function to apply.
911 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
914 * @brief Scale an actor to a target scale factor.
916 * This overload allows the scaling start & end time to be customized.
917 * @pre delaySeconds must be zero or greater.
918 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
919 * @param [in] actor The actor to animate.
920 * @param [in] scale The target scale factor.
921 * @param [in] alpha The alpha function to apply.
922 * @param [in] delaySeconds The initial delay from the start of the animation.
923 * @param [in] durationSeconds The duration of the scaling.
925 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
928 * @brief Show an actor during the animation.
930 * @param [in] actor The actor to animate.
931 * @param [in] delaySeconds The initial delay from the start of the animation.
933 void Show(Actor actor, float delaySeconds);
936 * @brief Hide an actor during the animation.
938 * @param [in] actor The actor to animate.
939 * @param [in] delaySeconds The initial delay from the start of the animation.
941 void Hide(Actor actor, float delaySeconds);
944 * @brief Animate the opacity of an actor.
946 * The default alpha function will be used.
947 * The effect will start & end when the animation begins & ends.
948 * @param [in] actor The actor to animate.
949 * @param [in] opacity The relative change in opacity.
951 void OpacityBy(Actor actor, float opacity);
954 * @brief Animate the opacity of an actor.
956 * This overload allows the alpha function to be customized.
957 * The effect will start & end when the animation begins & ends.
958 * @param [in] actor The actor to animate.
959 * @param [in] opacity The relative change in opacity.
960 * @param [in] alpha The alpha function to apply.
962 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
965 * @brief Animate the opacity of an actor.
967 * This overload allows the animation start & end time to be customized.
968 * @pre delaySeconds must be zero or greater.
969 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
970 * @param [in] actor The actor to animate.
971 * @param [in] opacity The relative change in opacity.
972 * @param [in] alpha The alpha function to apply.
973 * @param [in] delaySeconds The initial delay from the start of the animation.
974 * @param [in] durationSeconds The duration of the opacity animation.
976 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
979 * @brief Animate an actor to a target opacity.
981 * The default alpha function will be used.
982 * The effect will start & end when the animation begins & ends.
983 * @param [in] actor The actor to animate.
984 * @param [in] opacity The target opacity.
986 void OpacityTo(Actor actor, float opacity);
989 * @brief Animate an actor to a target opacity.
991 * This overload allows the alpha function to be customized.
992 * The effect will start & end when the animation begins & ends.
993 * @param [in] actor The actor to animate.
994 * @param [in] opacity The target opacity.
995 * @param [in] alpha The alpha function to apply.
997 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
1000 * @brief Animate an actor to a target opacity.
1002 * This overload allows the animation start & end time to be customized.
1003 * @pre delaySeconds must be zero or greater.
1004 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1005 * @param [in] actor The actor to animate.
1006 * @param [in] opacity The target opacity.
1007 * @param [in] alpha The alpha function to apply.
1008 * @param [in] delaySeconds The initial delay from the start of the animation.
1009 * @param [in] durationSeconds The duration of the opacity animation.
1011 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1014 * @brief Animate the color of an actor.
1016 * The default alpha function will be used.
1017 * The effect will start & end when the animation begins & ends.
1018 * @param [in] actor The actor to animate.
1019 * @param [in] color The relative change in color.
1021 void ColorBy(Actor actor, Vector4 color);
1024 * @brief Animate the color of an actor.
1026 * This overload allows the alpha function to be customized.
1027 * The effect will start & end when the animation begins & ends.
1028 * @param [in] actor The actor to animate.
1029 * @param [in] color The relative change in color.
1030 * @param [in] alpha The alpha function to apply.
1032 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
1035 * @brief Animate the color of an actor.
1037 * This overload allows the animation start & end time to be customized.
1038 * @pre delaySeconds must be zero or greater.
1039 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1040 * @param [in] actor The actor to animate.
1041 * @param [in] color The relative change in color.
1042 * @param [in] alpha The alpha function to apply.
1043 * @param [in] delaySeconds The initial delay from the start of the animation.
1044 * @param [in] durationSeconds The duration of the color animation.
1046 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1049 * @brief Animate an actor to a target color.
1051 * The default alpha function will be used.
1052 * The effect will start & end when the animation begins & ends.
1053 * @param [in] actor The actor to animate.
1054 * @param [in] color The target color.
1056 void ColorTo(Actor actor, Vector4 color);
1059 * @brief Animate an actor to a target color.
1061 * This overload allows the alpha function to be customized.
1062 * The effect will start & end when the animation begins & ends.
1063 * @param [in] actor The actor to animate.
1064 * @param [in] color The target color.
1065 * @param [in] alpha The alpha function to apply.
1067 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
1070 * @brief Animate an actor to a target color.
1072 * This overload allows the animation start & end time to be customized.
1073 * @pre delaySeconds must be zero or greater.
1074 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1075 * @param [in] actor The actor to animate.
1076 * @param [in] color The target color.
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 color animation.
1081 void ColorTo(Actor actor, Vector4 color, 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 * The depth defaults to the minimum of width & height.
1089 * @param [in] actor The actor to animate.
1090 * @param [in] width The target width.
1091 * @param [in] height The target height.
1093 void Resize(Actor actor, float width, float height);
1096 * @brief Resize an actor.
1098 * This overload allows the alpha function to be customized.
1099 * The resizing will start & end when the animation begins & ends.
1100 * The depth defaults to the minimum of width & height.
1101 * @param [in] actor The actor to animate.
1102 * @param [in] width The target width.
1103 * @param [in] height The target height.
1104 * @param [in] alpha The alpha function to apply.
1106 void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1109 * @brief Resize an actor.
1111 * This overload allows the resizing start & end time to be customized.
1112 * The depth defaults to the minimum of width & height.
1113 * @pre delaySeconds must be zero or greater.
1114 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1115 * @param [in] actor The actor to animate.
1116 * @param [in] width The target width.
1117 * @param [in] height The target height.
1118 * @param [in] alpha The alpha function to apply.
1119 * @param [in] delaySeconds The initial delay from the start of the animation.
1120 * @param [in] durationSeconds The duration of the resizing.
1122 void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1125 * @brief Resize an actor.
1127 * The default alpha function will be used.
1128 * The resizing will start & end when the animation begins & ends.
1129 * @param [in] actor The actor to animate.
1130 * @param [in] size The target size.
1132 void Resize(Actor actor, Vector3 size);
1135 * @brief Resize an actor.
1137 * This overload allows the alpha function to be customized.
1138 * The resizing will start & end when the animation begins & ends.
1139 * @param [in] actor The actor to animate.
1140 * @param [in] size The target size.
1141 * @param [in] alpha The alpha function to apply.
1143 void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1146 * @brief Resize an actor.
1148 * This overload allows the resizing start & end time to be customized.
1149 * @pre delaySeconds must be zero or greater.
1150 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1151 * @param [in] actor The actor to animate.
1152 * @param [in] size The target size.
1153 * @param [in] alpha The alpha function to apply.
1154 * @param [in] delaySeconds The initial delay from the start of the animation.
1155 * @param [in] durationSeconds The duration of the resizing.
1157 void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1159 public: // Not intended for use by Application developers
1162 * @brief This constructor is used by Dali New() methods
1163 * @param [in] animation A pointer to a newly allocated Dali resource
1165 explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1170 * @brief Animate a property using a custom function.
1172 * @pre The property type is equal expectedType.
1173 * @param [in] target The target object/property to animate.
1174 * @param [in] targetType The expected type of the property.
1175 * @param [in] func The function to call during the animation.
1177 void Animate( Property target,
1178 Property::Type targetType,
1182 * @brief Animate a property using a custom function.
1184 * @pre The property type is equal expectedType.
1185 * @param [in] target The target object/property to animate.
1186 * @param [in] targetType The expected type of the property.
1187 * @param [in] func The function to call during the animation.
1188 * @param [in] alpha The alpha function to apply.
1190 void Animate( Property target,
1191 Property::Type targetType,
1193 AlphaFunction alpha );
1196 * @brief Animate a property using a custom function.
1198 * @pre The property type is equal expectedType.
1199 * @param [in] target The target object/property to animate.
1200 * @param [in] targetType The expected type of the property.
1201 * @param [in] func The function to call during the animation.
1202 * @param [in] period The effect will occur during this time period.
1204 void Animate( Property target,
1205 Property::Type targetType,
1207 TimePeriod period );
1210 * @brief Animate a property using a custom function.
1212 * @pre The property type is equal expectedType.
1213 * @param [in] target The target object/property to animate.
1214 * @param [in] targetType The expected type of the property.
1215 * @param [in] func The function to call during the animation.
1216 * @param [in] alpha The alpha function to apply.
1217 * @param [in] period The effect will occur during this time period.
1219 void Animate( Property target,
1220 Property::Type targetType,
1222 AlphaFunction alpha,
1223 TimePeriod period );
1228 #endif // __DALI_ANIMATION_H__