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>
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;
247 * @brief Set the disconnect action.
249 * If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.
250 * Default action is to BakeFinal.
251 * @param[in] disconnectAction The disconnect action.
253 void SetDisconnectAction( EndAction disconnectAction );
256 * @brief Returns the disconnect action.
258 * @return The disconnect action.
260 EndAction GetDisconnectAction() 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 Sets the progress of the animation.
279 * The animation will play (or continue playing) from this point. The progress
280 * must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
281 * otherwise, it will be ignored.
283 * @param[in] progress The new progress as a normalized value between [0,1] or between the
284 * play range if specified.
286 void SetCurrentProgress( float progress );
289 * @brief Retrieve the current progress of the animation.
291 * @return The current progress as a normalized value between [0,1].
293 float GetCurrentProgress();
296 * @brief Specifies an speed factor for the animation.
298 * The speed factor is a multiplier of the normal velocity of the animation. Values between [0,1] will
299 * slow down the animation and values above one will speed up the animation. It is also possible to specify a negative multiplier
300 * to play the animation in reverse.
302 * @param[in] factor A value which will multiply the velocity.
304 void SetSpeedFactor( float factor );
307 * @brief Retrieve the speed factor of the animation
309 * @return speed factor
311 float GetSpeedFactor() const;
314 * @brief Set the playing range.
315 * Animation will play between the values specified. Both values ( range.x and range.y ) should be between 0-1,
316 * otherwise they will be ignored. If the range provided is not in proper order ( minimum,maximum ), it will be reordered.
318 * @param[in] range Two values between [0,1] to specify minimum and maximum progress. The
319 * animation will play between those values.
321 void SetPlayRange( const Vector2& range );
324 * @brief Get the playing range
326 * @return The play range defined for the animation.
328 Vector2 GetPlayRange() const;
331 * @brief Play the animation.
336 * @brief Play the animation from a given point.
337 * The progress must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
338 * otherwise, it will be ignored.
340 * @param[in] progress A value between [0,1], or between the play range if specified, form where the animation should start playing
342 void PlayFrom( float progress );
345 * @brief Pause the animation.
350 * @brief Stop the animation.
355 * @brief Clear the animation.
357 * This disconnects any objects that were being animated, effectively stopping the animation.
362 * @brief Connect to this signal to be notified when an Animation's animations have finished.
364 * @return A signal object to Connect() with.
366 AnimationSignalV2& FinishedSignal();
369 * @brief Animate a property value by a relative amount.
371 * The default alpha function will be used.
372 * The effect will start & end when the animation begins & ends.
373 * @param [in] target The target object/property to animate.
374 * @param [in] relativeValue The property value will change by this amount.
376 void AnimateBy(Property target, Property::Value relativeValue);
379 * @brief Animate a property value by a relative amount.
381 * The effect will start & end when the animation begins & ends.
382 * @param [in] target The target object/property to animate.
383 * @param [in] relativeValue The property value will change by this amount.
384 * @param [in] alpha The alpha function to apply.
386 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
389 * @brief Animate a property value by a relative amount.
391 * The default alpha function will be used.
392 * @param [in] target The target object/property to animate.
393 * @param [in] relativeValue The property value will increase/decrease by this amount.
394 * @param [in] period The effect will occur during this time period.
396 void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
399 * @brief Animate a property value by a relative amount.
401 * @param [in] target The target object/property to animate.
402 * @param [in] relativeValue The property value will increase/decrease by this amount.
403 * @param [in] alpha The alpha function to apply.
404 * @param [in] period The effect will occur during this time period.
406 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
409 * @brief Animate a property to a destination value.
411 * The default alpha function will be used.
412 * The effect will start & end when the animation begins & ends.
413 * @param [in] target The target object/property to animate.
414 * @param [in] destinationValue The destination value.
416 void AnimateTo(Property target, Property::Value destinationValue);
419 * @brief Animate a property to a destination value.
421 * The effect will start & end when the animation begins & ends.
422 * @param [in] target The target object/property to animate.
423 * @param [in] destinationValue The destination value.
424 * @param [in] alpha The alpha function to apply.
426 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
429 * @brief Animate a property to a destination value.
431 * The default alpha function will be used.
432 * @param [in] target The target object/property to animate.
433 * @param [in] destinationValue The destination value.
434 * @param [in] period The effect will occur during this time period.
436 void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
439 * @brief Animate a property to a destination value.
441 * @param [in] target The target object/property to animate.
442 * @param [in] destinationValue The destination value.
443 * @param [in] alpha The alpha function to apply.
444 * @param [in] period The effect will occur during this time period.
446 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
449 * @brief Animate a property between keyframes.
451 * @param [in] target The target object/property to animate.
452 * @param [in] keyFrames The key frames
454 void AnimateBetween(Property target, KeyFrames& keyFrames);
457 * @brief Animate a property between keyframes.
459 * @param [in] target The target object/property to animate.
460 * @param [in] keyFrames The key frames
461 * @param [in] alpha The alpha function to apply.
463 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
466 * @brief Animate a property between keyframes.
468 * @param [in] target The target object/property to animate.
469 * @param [in] keyFrames The key frames
470 * @param [in] period The effect will occur during this time period.
472 void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
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.
480 * @param [in] period The effect will occur during this time period.
482 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
485 * @brief Animate a property using a custom function.
487 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
488 * @pre The property type is equal PropertyTypes::Get<P>().
489 * @param [in] target The target object/property to animate.
490 * @param [in] animatorFunc The function to call during the animation.
493 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc )
495 Animate( target, PropertyTypes::Get<P>(), animatorFunc );
499 * @brief Animate a property using a custom function.
501 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
502 * @pre The property type is equal PropertyTypes::Get<P>().
503 * @param [in] target The target object/property to animate.
504 * @param [in] animatorFunc The function to call during the animation.
505 * @param [in] alpha The alpha function to apply.
508 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha )
510 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha );
514 * @brief Animate a property using a custom function.
516 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
517 * @pre The property type is equal PropertyTypes::Get<P>().
518 * @param [in] target The target object/property to animate.
519 * @param [in] animatorFunc The function to call during the animation.
520 * @param [in] period The effect will occur during this time period.
523 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, TimePeriod period )
525 Animate( target, PropertyTypes::Get<P>(), animatorFunc, period );
529 * @brief Animate a property using a custom function.
531 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
532 * @pre The property type is equal PropertyTypes::Get<P>().
533 * @param [in] target The target object/property to animate.
534 * @param [in] animatorFunc The function to call during the animation.
535 * @param [in] alpha The alpha function to apply.
536 * @param [in] period The effect will occur during this time period.
539 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha, TimePeriod period )
541 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha, period );
544 // Actor-specific convenience methods
547 * @brief Move an actor relative to its position.
549 * The default alpha function will be used.
550 * The move will start & end when the animation begins & ends.
551 * @param [in] actor The actor to animate.
552 * @param [in] x axis displacement.
553 * @param [in] y axis displacement.
554 * @param [in] z axis displacement.
556 void MoveBy(Actor actor, float x, float y, float z);
559 * @brief Move an actor relative to its position.
561 * This overload allows the alpha function to be customized.
562 * The move will start & end when the animation begins & ends.
563 * @param [in] actor The actor to animate.
564 * @param [in] displacement relative to current position.
565 * @param [in] alpha The alpha function to apply.
567 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
570 * @brief Move an actor relative to its position.
572 * This overload allows the translation start & end time to be customized.
573 * @pre delaySeconds must be zero or greater.
574 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
575 * @param [in] actor The actor to animate.
576 * @param [in] displacement relative to current position.
577 * @param [in] alpha The alpha function to apply.
578 * @param [in] delaySeconds The initial delay from the start of the animation.
579 * @param [in] durationSeconds The duration of the translation.
581 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
584 * @brief Move an actor to a target position.
586 * The default alpha function will be used.
587 * The move will start & end when the animation begins & ends.
588 * @param [in] actor The actor to animate.
589 * @param [in] x axis position.
590 * @param [in] y axis position.
591 * @param [in] z axis position.
593 void MoveTo(Actor actor, float x, float y, float z);
596 * @brief Move an actor to a target position.
598 * This overload allows the alpha function to be customized.
599 * The move will start & end when the animation begins & ends.
600 * @param [in] actor The actor to animate.
601 * @param [in] position to move to
602 * @param [in] alpha The alpha function to apply.
604 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
607 * @brief Move an actor to a target position.
609 * This overload allows the translation start & end time to be customized.
610 * @pre delaySeconds must be zero or greater.
611 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
612 * @param [in] actor The actor to animate.
613 * @param [in] position to move to
614 * @param [in] alpha The alpha function to apply.
615 * @param [in] delaySeconds The initial delay from the start of the animation.
616 * @param [in] durationSeconds The duration of the translation.
618 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
621 * @brief Move an actor using a custom function.
623 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
624 * @pre delaySeconds must be zero or greater.
625 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
626 * @param [in] actor The actor to animate.
627 * @param [in] animatorFunc The function to call during the animation.
628 * @param [in] alpha The alpha function to apply.
629 * @param [in] delaySeconds The initial delay from the start of the animation.
630 * @param [in] durationSeconds The duration of the translation.
632 void Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
635 * @brief Rotate an actor around an arbitrary axis.
637 * The default alpha function will be used.
638 * The rotation will start & end when the animation begins & ends.
639 * @param [in] actor The actor to animate.
640 * @param [in] angle The angle in degrees.
641 * @param [in] axis The axis to rotate around
643 void RotateBy(Actor actor, Degree angle, Vector3 axis);
646 * @brief Rotate an actor around an arbitrary axis.
648 * The default alpha function will be used.
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
654 void RotateBy(Actor actor, Radian angle, Vector3 axis);
657 * @brief Rotate an actor around an arbitrary axis.
659 * This overload allows the alpha function to be customized.
660 * The rotation will start & end when the animation begins & ends.
661 * @param [in] actor The actor to animate.
662 * @param [in] angle The angle in radians.
663 * @param [in] axis The axis to rotate around.
664 * @param [in] alpha The alpha function to apply.
666 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
669 * @brief Rotate an actor around an arbitrary axis.
671 * This overload allows the alpha function to be customized.
672 * The rotation will start & end when the animation begins & ends.
673 * @param [in] actor The actor to animate.
674 * @param [in] angle The angle in radians.
675 * @param [in] axis The axis to rotate around.
676 * @param [in] alpha The alpha function to apply.
678 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
681 * @brief Rotate an actor around an arbitrary axis.
683 * This overload allows the rotation start & end time to be customized.
684 * @pre delaySeconds must be zero or greater.
685 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
686 * @param [in] actor The actor to animate.
687 * @param [in] angle The angle in degrees.
688 * @param [in] axis The axis to rotate around
689 * @param [in] alpha The alpha function to apply.
690 * @param [in] delaySeconds The initial delay from the start of the animation.
691 * @param [in] durationSeconds The duration of the rotation.
693 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
696 * @brief Rotate an actor around an arbitrary axis.
698 * This overload allows the rotation start & end time to be customized.
699 * @pre delaySeconds must be zero or greater.
700 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
701 * @param [in] actor The actor to animate.
702 * @param [in] angle The angle in radians.
703 * @param [in] axis The axis to rotate around
704 * @param [in] alpha The alpha function to apply.
705 * @param [in] delaySeconds The initial delay from the start of the animation.
706 * @param [in] durationSeconds The duration of the rotation.
708 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
711 * @brief Rotate an actor to a target orientation.
713 * The default alpha function will be used.
714 * The rotation will start & end when the animation begins & ends.
715 * @param [in] actor The actor to animate.
716 * @param [in] angle The target rotation angle in degrees.
717 * @param [in] axis The target axis of rotation.
719 void RotateTo(Actor actor, Degree angle, Vector3 axis);
722 * @brief Rotate an actor to a target orientation.
724 * The default alpha function will be used.
725 * The rotation will start & end when the animation begins & ends.
726 * @param [in] actor The actor to animate.
727 * @param [in] angle The target rotation angle in radians.
728 * @param [in] axis The target axis of rotation.
730 void RotateTo(Actor actor, Radian angle, Vector3 axis);
733 * @brief Rotate an actor to a target orientation.
735 * The default alpha function will be used.
736 * The rotation will start & end when the animation begins & ends.
737 * @param [in] actor The actor to animate.
738 * @param [in] orientation The target orientation.
740 void RotateTo(Actor actor, Quaternion orientation);
743 * @brief Rotate an actor to a target orientation.
745 * This overload allows the alpha function to be customized.
746 * The rotation will start & end when the animation begins & ends.
747 * @param [in] actor The actor to animate.
748 * @param [in] angle The target rotation angle in degrees.
749 * @param [in] axis The target axis of rotation.
750 * @param [in] alpha The alpha function to apply.
752 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
755 * @brief Rotate an actor to a target orientation.
757 * This overload allows the alpha function to be customized.
758 * The rotation will start & end when the animation begins & ends.
759 * @param [in] actor The actor to animate.
760 * @param [in] angle The target rotation angle in radians.
761 * @param [in] axis The target axis of rotation.
762 * @param [in] alpha The alpha function to apply.
764 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
767 * @brief Rotate an actor to a target orientation.
769 * This overload allows the alpha function to be customized.
770 * The rotation will start & end when the animation begins & ends.
771 * @param [in] actor The actor to animate.
772 * @param [in] orientation The target orientation.
773 * @param [in] alpha The alpha function to apply.
775 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
778 * @brief Rotate an actor to a target orientation.
780 * This overload allows the rotation start & end time to be customized.
781 * @pre delaySeconds must be zero or greater.
782 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
783 * @param [in] actor The actor to animate.
784 * @param [in] angle The target rotation angle in degrees.
785 * @param [in] axis The target axis of rotation.
786 * @param [in] alpha The alpha function to apply.
787 * @param [in] delaySeconds The initial delay from the start of the animation.
788 * @param [in] durationSeconds The duration of the rotation.
790 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
793 * @brief Rotate an actor to a target orientation.
795 * This overload allows the rotation start & end time to be customized.
796 * @pre delaySeconds must be zero or greater.
797 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
798 * @param [in] actor The actor to animate.
799 * @param [in] angle The target rotation angle in radians.
800 * @param [in] axis The target axis of rotation.
801 * @param [in] alpha The alpha function to apply.
802 * @param [in] delaySeconds The initial delay from the start of the animation.
803 * @param [in] durationSeconds The duration of the rotation.
805 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
808 * @brief Rotate an actor to a target orientation.
810 * This overload allows the rotation start & end time to be customized.
811 * @pre delaySeconds must be zero or greater.
812 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
813 * @param [in] actor The actor to animate.
814 * @param [in] orientation The target orientation.
815 * @param [in] alpha The alpha function to apply.
816 * @param [in] delaySeconds The initial delay from the start of the animation.
817 * @param [in] durationSeconds The duration of the rotation.
819 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
822 * @brief Rotate an actor using a custom function.
824 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
825 * @pre delaySeconds must be zero or greater.
826 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
827 * @param [in] actor The actor to animate.
828 * @param [in] animatorFunc The function to call during the animation.
829 * @param [in] alpha The alpha function to apply.
830 * @param [in] delaySeconds The initial delay from the start of the animation.
831 * @param [in] durationSeconds The duration of the rotation.
833 void Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
836 * @brief Scale an actor.
838 * The default alpha function will be used.
839 * The scaling will start & end when the animation begins & ends.
840 * @param [in] actor The actor to animate.
841 * @param [in] x Scale factor in the X-direction.
842 * @param [in] y Scale factor in the Y-direction.
843 * @param [in] z Scale factor in the Z-direction.
845 void ScaleBy(Actor actor, float x, float y, float z);
848 * @brief Scale an actor.
850 * This overload allows the alpha function to be customized.
851 * The scaling will start & end when the animation begins & ends.
852 * @param [in] actor The actor to animate.
853 * @param [in] scale The scale factor.
854 * @param [in] alpha The alpha function to apply.
856 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
859 * @brief Scale an actor.
861 * This overload allows the scaling start & end time to be customized.
862 * @pre delaySeconds must be zero or greater.
863 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
864 * @param [in] actor The actor to animate.
865 * @param [in] scale The scale factor.
866 * @param [in] alpha The alpha function to apply.
867 * @param [in] delaySeconds The initial delay from the start of the animation.
868 * @param [in] durationSeconds The duration of the scaling.
870 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
873 * @brief Scale an actor to a target scale factor.
875 * The default alpha function will be used.
876 * The scaling will start & end when the animation begins & ends.
877 * @param [in] actor The actor to animate.
878 * @param [in] x Target scale-factor in the X-direction.
879 * @param [in] y Target scale-factor in the Y-direction.
880 * @param [in] z Target scale-factor in the Z-direction.
882 void ScaleTo(Actor actor, float x, float y, float z);
885 * @brief Scale an actor to a target scale factor.
887 * This overload allows the alpha function to be customized.
888 * The scaling will start & end when the animation begins & ends.
889 * @param [in] actor The actor to animate.
890 * @param [in] scale The target scale factor.
891 * @param [in] alpha The alpha function to apply.
893 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
896 * @brief Scale an actor to a target scale factor.
898 * This overload allows the scaling start & end time to be customized.
899 * @pre delaySeconds must be zero or greater.
900 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
901 * @param [in] actor The actor to animate.
902 * @param [in] scale The target scale factor.
903 * @param [in] alpha The alpha function to apply.
904 * @param [in] delaySeconds The initial delay from the start of the animation.
905 * @param [in] durationSeconds The duration of the scaling.
907 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
910 * @brief Show an actor during the animation.
912 * @param [in] actor The actor to animate.
913 * @param [in] delaySeconds The initial delay from the start of the animation.
915 void Show(Actor actor, float delaySeconds);
918 * @brief Hide an actor during the animation.
920 * @param [in] actor The actor to animate.
921 * @param [in] delaySeconds The initial delay from the start of the animation.
923 void Hide(Actor actor, float delaySeconds);
926 * @brief Animate the opacity of an actor.
928 * The default alpha function will be used.
929 * The effect will start & end when the animation begins & ends.
930 * @param [in] actor The actor to animate.
931 * @param [in] opacity The relative change in opacity.
933 void OpacityBy(Actor actor, float opacity);
936 * @brief Animate the opacity of an actor.
938 * This overload allows the alpha function to be customized.
939 * The effect will start & end when the animation begins & ends.
940 * @param [in] actor The actor to animate.
941 * @param [in] opacity The relative change in opacity.
942 * @param [in] alpha The alpha function to apply.
944 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
947 * @brief Animate the opacity of an actor.
949 * This overload allows the animation start & end time to be customized.
950 * @pre delaySeconds must be zero or greater.
951 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
952 * @param [in] actor The actor to animate.
953 * @param [in] opacity The relative change in opacity.
954 * @param [in] alpha The alpha function to apply.
955 * @param [in] delaySeconds The initial delay from the start of the animation.
956 * @param [in] durationSeconds The duration of the opacity animation.
958 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
961 * @brief Animate an actor to a target opacity.
963 * The default alpha function will be used.
964 * The effect will start & end when the animation begins & ends.
965 * @param [in] actor The actor to animate.
966 * @param [in] opacity The target opacity.
968 void OpacityTo(Actor actor, float opacity);
971 * @brief Animate an actor to a target opacity.
973 * This overload allows the alpha function to be customized.
974 * The effect will start & end when the animation begins & ends.
975 * @param [in] actor The actor to animate.
976 * @param [in] opacity The target opacity.
977 * @param [in] alpha The alpha function to apply.
979 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
982 * @brief Animate an actor to a target opacity.
984 * This overload allows the animation start & end time to be customized.
985 * @pre delaySeconds must be zero or greater.
986 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
987 * @param [in] actor The actor to animate.
988 * @param [in] opacity The target opacity.
989 * @param [in] alpha The alpha function to apply.
990 * @param [in] delaySeconds The initial delay from the start of the animation.
991 * @param [in] durationSeconds The duration of the opacity animation.
993 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
996 * @brief Animate the color of an actor.
998 * The default alpha function will be used.
999 * The effect will start & end when the animation begins & ends.
1000 * @param [in] actor The actor to animate.
1001 * @param [in] color The relative change in color.
1003 void ColorBy(Actor actor, Vector4 color);
1006 * @brief Animate the color of an actor.
1008 * This overload allows the alpha function to be customized.
1009 * The effect will start & end when the animation begins & ends.
1010 * @param [in] actor The actor to animate.
1011 * @param [in] color The relative change in color.
1012 * @param [in] alpha The alpha function to apply.
1014 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
1017 * @brief Animate the color of an actor.
1019 * This overload allows the animation start & end time to be customized.
1020 * @pre delaySeconds must be zero or greater.
1021 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1022 * @param [in] actor The actor to animate.
1023 * @param [in] color The relative change in color.
1024 * @param [in] alpha The alpha function to apply.
1025 * @param [in] delaySeconds The initial delay from the start of the animation.
1026 * @param [in] durationSeconds The duration of the color animation.
1028 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1031 * @brief Animate an actor to a target color.
1033 * The default alpha function will be used.
1034 * The effect will start & end when the animation begins & ends.
1035 * @param [in] actor The actor to animate.
1036 * @param [in] color The target color.
1038 void ColorTo(Actor actor, Vector4 color);
1041 * @brief Animate an actor to a target color.
1043 * This overload allows the alpha function to be customized.
1044 * The effect will start & end when the animation begins & ends.
1045 * @param [in] actor The actor to animate.
1046 * @param [in] color The target color.
1047 * @param [in] alpha The alpha function to apply.
1049 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
1052 * @brief Animate an actor to a target color.
1054 * This overload allows the animation start & end time to be customized.
1055 * @pre delaySeconds must be zero or greater.
1056 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1057 * @param [in] actor The actor to animate.
1058 * @param [in] color The target color.
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 color animation.
1063 void ColorTo(Actor actor, Vector4 color, 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 * The depth defaults to the minimum of width & height.
1071 * @param [in] actor The actor to animate.
1072 * @param [in] width The target width.
1073 * @param [in] height The target height.
1075 void Resize(Actor actor, float width, float height);
1078 * @brief Resize an actor.
1080 * This overload allows the alpha function to be customized.
1081 * The resizing will start & end when the animation begins & ends.
1082 * The depth defaults to the minimum of width & height.
1083 * @param [in] actor The actor to animate.
1084 * @param [in] width The target width.
1085 * @param [in] height The target height.
1086 * @param [in] alpha The alpha function to apply.
1088 void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1091 * @brief Resize an actor.
1093 * This overload allows the resizing start & end time to be customized.
1094 * The depth defaults to the minimum of width & height.
1095 * @pre delaySeconds must be zero or greater.
1096 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1097 * @param [in] actor The actor to animate.
1098 * @param [in] width The target width.
1099 * @param [in] height The target height.
1100 * @param [in] alpha The alpha function to apply.
1101 * @param [in] delaySeconds The initial delay from the start of the animation.
1102 * @param [in] durationSeconds The duration of the resizing.
1104 void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1107 * @brief Resize an actor.
1109 * The default alpha function will be used.
1110 * The resizing will start & end when the animation begins & ends.
1111 * @param [in] actor The actor to animate.
1112 * @param [in] size The target size.
1114 void Resize(Actor actor, Vector3 size);
1117 * @brief Resize an actor.
1119 * This overload allows the alpha function to be customized.
1120 * The resizing will start & end when the animation begins & ends.
1121 * @param [in] actor The actor to animate.
1122 * @param [in] size The target size.
1123 * @param [in] alpha The alpha function to apply.
1125 void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1128 * @brief Resize an actor.
1130 * This overload allows the resizing start & end time to be customized.
1131 * @pre delaySeconds must be zero or greater.
1132 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1133 * @param [in] actor The actor to animate.
1134 * @param [in] size The target size.
1135 * @param [in] alpha The alpha function to apply.
1136 * @param [in] delaySeconds The initial delay from the start of the animation.
1137 * @param [in] durationSeconds The duration of the resizing.
1139 void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1141 public: // Not intended for use by Application developers
1144 * @brief This constructor is used by Dali New() methods
1145 * @param [in] animation A pointer to a newly allocated Dali resource
1147 explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1152 * @brief Animate a property using a custom function.
1154 * @pre The property type is equal expectedType.
1155 * @param [in] target The target object/property to animate.
1156 * @param [in] targetType The expected type of the property.
1157 * @param [in] func The function to call during the animation.
1159 void Animate( Property target,
1160 Property::Type targetType,
1164 * @brief Animate a property using a custom function.
1166 * @pre The property type is equal expectedType.
1167 * @param [in] target The target object/property to animate.
1168 * @param [in] targetType The expected type of the property.
1169 * @param [in] func The function to call during the animation.
1170 * @param [in] alpha The alpha function to apply.
1172 void Animate( Property target,
1173 Property::Type targetType,
1175 AlphaFunction alpha );
1178 * @brief Animate a property using a custom function.
1180 * @pre The property type is equal expectedType.
1181 * @param [in] target The target object/property to animate.
1182 * @param [in] targetType The expected type of the property.
1183 * @param [in] func The function to call during the animation.
1184 * @param [in] period The effect will occur during this time period.
1186 void Animate( Property target,
1187 Property::Type targetType,
1189 TimePeriod period );
1192 * @brief Animate a property using a custom function.
1194 * @pre The property type is equal expectedType.
1195 * @param [in] target The target object/property to animate.
1196 * @param [in] targetType The expected type of the property.
1197 * @param [in] func The function to call during the animation.
1198 * @param [in] alpha The alpha function to apply.
1199 * @param [in] period The effect will occur during this time period.
1201 void Animate( Property target,
1202 Property::Type targetType,
1204 AlphaFunction alpha,
1205 TimePeriod period );
1210 #endif // __DALI_ANIMATION_H__