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.SignalFinished().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 * @copydoc Dali::BaseHandle::operator=
179 using BaseHandle::operator=;
182 * @brief Set the duration of an animation.
184 * @pre durationSeconds must be greater than zero.
185 * @param[in] seconds The duration in seconds.
187 void SetDuration(float seconds);
190 * @brief Retrieve the duration of an animation.
192 * @return The duration in seconds.
194 float GetDuration() const;
197 * @brief Set whether the animation will loop.
199 * @param[in] looping True if the animation will loop.
201 void SetLooping(bool looping);
204 * @brief Query whether the animation will loop.
206 * @return True if the animation will loop.
208 bool IsLooping() const;
211 * @brief Set the end action of the animation.
213 * This action is performed when the animation ends.
214 * Default end action is bake
215 * @param[in] action The end action.
217 void SetEndAction(EndAction action);
220 * @brief Returns the end action of the animation.
222 * @return The end action.
224 EndAction GetEndAction() const;
227 * @brief Set the destroy action of the animation.
229 * If the animation is destroyed this action is performed on the following update.
230 * Default destroy action is bake
231 * @param[in] action The destroy action.
233 void SetDestroyAction(EndAction action);
236 * @brief Returns the destroy action of the animation.
238 * @return The destroy action.
240 EndAction GetDestroyAction() const;
243 * @brief Set the default alpha function for an animation.
245 * This is applied to individual property animations, if no further alpha functions are supplied.
246 * @param[in] alpha The default alpha function.
248 void SetDefaultAlphaFunction(AlphaFunction alpha);
251 * @brief Retrieve the default alpha function for an animation.
253 * @return The default alpha function.
255 AlphaFunction GetDefaultAlphaFunction() const;
258 * @brief Retrieve the current progress of the animation.
260 * @return The current progress as a normalized value between [0,1].
262 float GetCurrentProgress();
265 * @brief Sets the progress of the animation.
266 * The animation will play (or continue playing) from this point
268 * @param[in] progress The new progress as a normalized value between [0,1].
270 void SetCurrentProgress( float progress );
273 * @brief Play the animation.
278 * @brief Play the animation from a given point.
279 * @param[in] progress A value between [0,1] form where the animation should start playing
281 void PlayFrom( float progress );
284 * @brief Pause the animation.
289 * @brief Stop the animation.
294 * @brief Clear the animation.
296 * This disconnects any objects that were being animated, effectively stopping the animation.
301 * @brief Connect to this signal to be notified when an Animation's animations have finished.
303 * @return A signal object to Connect() with.
305 AnimationSignalV2& FinishedSignal();
308 * @brief Animate a property value by a relative amount.
310 * The default alpha function will be used.
311 * The effect will start & end when the animation begins & ends.
312 * @param [in] target The target object/property to animate.
313 * @param [in] relativeValue The property value will change by this amount.
315 void AnimateBy(Property target, Property::Value relativeValue);
318 * @brief Animate a property value by a relative amount.
320 * The effect will start & end when the animation begins & ends.
321 * @param [in] target The target object/property to animate.
322 * @param [in] relativeValue The property value will change by this amount.
323 * @param [in] alpha The alpha function to apply.
325 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
328 * @brief Animate a property value by a relative amount.
330 * The default alpha function will be used.
331 * @param [in] target The target object/property to animate.
332 * @param [in] relativeValue The property value will increase/decrease by this amount.
333 * @param [in] period The effect will occur during this time period.
335 void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
338 * @brief Animate a property value by a relative amount.
340 * @param [in] target The target object/property to animate.
341 * @param [in] relativeValue The property value will increase/decrease by this amount.
342 * @param [in] alpha The alpha function to apply.
343 * @param [in] period The effect will occur during this time period.
345 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
348 * @brief Animate a property to a destination value.
350 * The default alpha function will be used.
351 * The effect will start & end when the animation begins & ends.
352 * @param [in] target The target object/property to animate.
353 * @param [in] destinationValue The destination value.
355 void AnimateTo(Property target, Property::Value destinationValue);
358 * @brief Animate a property to a destination value.
360 * The effect will start & end when the animation begins & ends.
361 * @param [in] target The target object/property to animate.
362 * @param [in] destinationValue The destination value.
363 * @param [in] alpha The alpha function to apply.
365 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
368 * @brief Animate a property to a destination value.
370 * The default alpha function will be used.
371 * @param [in] target The target object/property to animate.
372 * @param [in] destinationValue The destination value.
373 * @param [in] period The effect will occur during this time period.
375 void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
378 * @brief Animate a property to a destination value.
380 * @param [in] target The target object/property to animate.
381 * @param [in] destinationValue The destination value.
382 * @param [in] alpha The alpha function to apply.
383 * @param [in] period The effect will occur during this time period.
385 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
388 * @brief Animate a property between keyframes.
390 * @param [in] target The target object/property to animate.
391 * @param [in] keyFrames The key frames
393 void AnimateBetween(Property target, KeyFrames& keyFrames);
396 * @brief Animate a property between keyframes.
398 * @param [in] target The target object/property to animate.
399 * @param [in] keyFrames The key frames
400 * @param [in] alpha The alpha function to apply.
402 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
405 * @brief Animate a property between keyframes.
407 * @param [in] target The target object/property to animate.
408 * @param [in] keyFrames The key frames
409 * @param [in] period The effect will occur during this time period.
411 void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
414 * @brief Animate a property between keyframes.
416 * @param [in] target The target object/property to animate.
417 * @param [in] keyFrames The key frames
418 * @param [in] alpha The alpha function to apply.
419 * @param [in] period The effect will occur during this time period.
421 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
424 * @brief Animate a property using a custom function.
426 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
427 * @pre The property type is equal PropertyTypes::Get<P>().
428 * @param [in] target The target object/property to animate.
429 * @param [in] animatorFunc The function to call during the animation.
432 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc )
434 Animate( target, PropertyTypes::Get<P>(), animatorFunc );
438 * @brief Animate a property using a custom function.
440 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
441 * @pre The property type is equal PropertyTypes::Get<P>().
442 * @param [in] target The target object/property to animate.
443 * @param [in] animatorFunc The function to call during the animation.
444 * @param [in] alpha The alpha function to apply.
447 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha )
449 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha );
453 * @brief Animate a property using a custom function.
455 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
456 * @pre The property type is equal PropertyTypes::Get<P>().
457 * @param [in] target The target object/property to animate.
458 * @param [in] animatorFunc The function to call during the animation.
459 * @param [in] period The effect will occur during this time period.
462 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, TimePeriod period )
464 Animate( target, PropertyTypes::Get<P>(), animatorFunc, period );
468 * @brief Animate a property using a custom function.
470 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
471 * @pre The property type is equal PropertyTypes::Get<P>().
472 * @param [in] target The target object/property to animate.
473 * @param [in] animatorFunc The function to call during the animation.
474 * @param [in] alpha The alpha function to apply.
475 * @param [in] period The effect will occur during this time period.
478 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha, TimePeriod period )
480 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha, period );
483 // Actor-specific convenience methods
486 * @brief Move an actor relative to its position.
488 * The default alpha function will be used.
489 * The move will start & end when the animation begins & ends.
490 * @param [in] actor The actor to animate.
491 * @param [in] x axis displacement.
492 * @param [in] y axis displacement.
493 * @param [in] z axis displacement.
495 void MoveBy(Actor actor, float x, float y, float z);
498 * @brief Move an actor relative to its position.
500 * This overload allows the alpha function to be customized.
501 * The move will start & end when the animation begins & ends.
502 * @param [in] actor The actor to animate.
503 * @param [in] displacement relative to current position.
504 * @param [in] alpha The alpha function to apply.
506 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
509 * @brief Move an actor relative to its position.
511 * This overload allows the translation start & end time to be customized.
512 * @pre delaySeconds must be zero or greater.
513 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
514 * @param [in] actor The actor to animate.
515 * @param [in] displacement relative to current position.
516 * @param [in] alpha The alpha function to apply.
517 * @param [in] delaySeconds The initial delay from the start of the animation.
518 * @param [in] durationSeconds The duration of the translation.
520 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
523 * @brief Move an actor to a target position.
525 * The default alpha function will be used.
526 * The move will start & end when the animation begins & ends.
527 * @param [in] actor The actor to animate.
528 * @param [in] x axis position.
529 * @param [in] y axis position.
530 * @param [in] z axis position.
532 void MoveTo(Actor actor, float x, float y, float z);
535 * @brief Move an actor to a target position.
537 * This overload allows the alpha function to be customized.
538 * The move will start & end when the animation begins & ends.
539 * @param [in] actor The actor to animate.
540 * @param [in] position to move to
541 * @param [in] alpha The alpha function to apply.
543 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
546 * @brief Move an actor to a target position.
548 * This overload allows the translation start & end time to be customized.
549 * @pre delaySeconds must be zero or greater.
550 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
551 * @param [in] actor The actor to animate.
552 * @param [in] position to move to
553 * @param [in] alpha The alpha function to apply.
554 * @param [in] delaySeconds The initial delay from the start of the animation.
555 * @param [in] durationSeconds The duration of the translation.
557 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
560 * @brief Move an actor using a custom function.
562 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
563 * @pre delaySeconds must be zero or greater.
564 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
565 * @param [in] actor The actor to animate.
566 * @param [in] animatorFunc The function to call during the animation.
567 * @param [in] alpha The alpha function to apply.
568 * @param [in] delaySeconds The initial delay from the start of the animation.
569 * @param [in] durationSeconds The duration of the translation.
571 void Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
574 * @brief Rotate an actor around an arbitrary axis.
576 * The default alpha function will be used.
577 * The rotation will start & end when the animation begins & ends.
578 * @param [in] actor The actor to animate.
579 * @param [in] angle The angle in degrees.
580 * @param [in] axis The axis to rotate around
582 void RotateBy(Actor actor, Degree angle, Vector3 axis);
585 * @brief Rotate an actor around an arbitrary axis.
587 * The default alpha function will be used.
588 * The rotation will start & end when the animation begins & ends.
589 * @param [in] actor The actor to animate.
590 * @param [in] angle The angle in radians.
591 * @param [in] axis The axis to rotate around
593 void RotateBy(Actor actor, Radian angle, Vector3 axis);
596 * @brief Rotate an actor around an arbitrary axis.
598 * This overload allows the alpha function to be customized.
599 * The rotation will start & end when the animation begins & ends.
600 * @param [in] actor The actor to animate.
601 * @param [in] angle The angle in radians.
602 * @param [in] axis The axis to rotate around.
603 * @param [in] alpha The alpha function to apply.
605 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
608 * @brief Rotate an actor around an arbitrary axis.
610 * This overload allows the alpha function to be customized.
611 * The rotation will start & end when the animation begins & ends.
612 * @param [in] actor The actor to animate.
613 * @param [in] angle The angle in radians.
614 * @param [in] axis The axis to rotate around.
615 * @param [in] alpha The alpha function to apply.
617 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
620 * @brief Rotate an actor around an arbitrary axis.
622 * This overload allows the rotation start & end time to be customized.
623 * @pre delaySeconds must be zero or greater.
624 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
625 * @param [in] actor The actor to animate.
626 * @param [in] angle The angle in degrees.
627 * @param [in] axis The axis to rotate around
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 rotation.
632 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
635 * @brief Rotate an actor around an arbitrary axis.
637 * This overload allows the rotation start & end time to be customized.
638 * @pre delaySeconds must be zero or greater.
639 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
640 * @param [in] actor The actor to animate.
641 * @param [in] angle The angle in radians.
642 * @param [in] axis The axis to rotate around
643 * @param [in] alpha The alpha function to apply.
644 * @param [in] delaySeconds The initial delay from the start of the animation.
645 * @param [in] durationSeconds The duration of the rotation.
647 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
650 * @brief Rotate an actor to a target orientation.
652 * The default alpha function will be used.
653 * The rotation will start & end when the animation begins & ends.
654 * @param [in] actor The actor to animate.
655 * @param [in] angle The target rotation angle in degrees.
656 * @param [in] axis The target axis of rotation.
658 void RotateTo(Actor actor, Degree angle, Vector3 axis);
661 * @brief Rotate an actor to a target orientation.
663 * The default alpha function will be used.
664 * The rotation will start & end when the animation begins & ends.
665 * @param [in] actor The actor to animate.
666 * @param [in] angle The target rotation angle in radians.
667 * @param [in] axis The target axis of rotation.
669 void RotateTo(Actor actor, Radian angle, Vector3 axis);
672 * @brief Rotate an actor to a target orientation.
674 * The default alpha function will be used.
675 * The rotation will start & end when the animation begins & ends.
676 * @param [in] actor The actor to animate.
677 * @param [in] orientation The target orientation.
679 void RotateTo(Actor actor, Quaternion orientation);
682 * @brief Rotate an actor to a target orientation.
684 * This overload allows the alpha function to be customized.
685 * The rotation will start & end when the animation begins & ends.
686 * @param [in] actor The actor to animate.
687 * @param [in] angle The target rotation angle in degrees.
688 * @param [in] axis The target axis of rotation.
689 * @param [in] alpha The alpha function to apply.
691 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
694 * @brief Rotate an actor to a target orientation.
696 * This overload allows the alpha function to be customized.
697 * The rotation will start & end when the animation begins & ends.
698 * @param [in] actor The actor to animate.
699 * @param [in] angle The target rotation angle in radians.
700 * @param [in] axis The target axis of rotation.
701 * @param [in] alpha The alpha function to apply.
703 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
706 * @brief Rotate an actor to a target orientation.
708 * This overload allows the alpha function to be customized.
709 * The rotation will start & end when the animation begins & ends.
710 * @param [in] actor The actor to animate.
711 * @param [in] orientation The target orientation.
712 * @param [in] alpha The alpha function to apply.
714 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
717 * @brief Rotate an actor to a target orientation.
719 * This overload allows the rotation start & end time to be customized.
720 * @pre delaySeconds must be zero or greater.
721 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
722 * @param [in] actor The actor to animate.
723 * @param [in] angle The target rotation angle in degrees.
724 * @param [in] axis The target axis of rotation.
725 * @param [in] alpha The alpha function to apply.
726 * @param [in] delaySeconds The initial delay from the start of the animation.
727 * @param [in] durationSeconds The duration of the rotation.
729 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
732 * @brief Rotate an actor to a target orientation.
734 * This overload allows the rotation start & end time to be customized.
735 * @pre delaySeconds must be zero or greater.
736 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
737 * @param [in] actor The actor to animate.
738 * @param [in] angle The target rotation angle in radians.
739 * @param [in] axis The target axis of rotation.
740 * @param [in] alpha The alpha function to apply.
741 * @param [in] delaySeconds The initial delay from the start of the animation.
742 * @param [in] durationSeconds The duration of the rotation.
744 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
747 * @brief Rotate an actor to a target orientation.
749 * This overload allows the rotation start & end time to be customized.
750 * @pre delaySeconds must be zero or greater.
751 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
752 * @param [in] actor The actor to animate.
753 * @param [in] orientation The target orientation.
754 * @param [in] alpha The alpha function to apply.
755 * @param [in] delaySeconds The initial delay from the start of the animation.
756 * @param [in] durationSeconds The duration of the rotation.
758 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
761 * @brief Rotate an actor using a custom function.
763 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
764 * @pre delaySeconds must be zero or greater.
765 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
766 * @param [in] actor The actor to animate.
767 * @param [in] animatorFunc The function to call during the animation.
768 * @param [in] alpha The alpha function to apply.
769 * @param [in] delaySeconds The initial delay from the start of the animation.
770 * @param [in] durationSeconds The duration of the rotation.
772 void Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
775 * @brief Scale an actor.
777 * The default alpha function will be used.
778 * The scaling will start & end when the animation begins & ends.
779 * @param [in] actor The actor to animate.
780 * @param [in] x Scale factor in the X-direction.
781 * @param [in] y Scale factor in the Y-direction.
782 * @param [in] z Scale factor in the Z-direction.
784 void ScaleBy(Actor actor, float x, float y, float z);
787 * @brief Scale an actor.
789 * This overload allows the alpha function to be customized.
790 * The scaling will start & end when the animation begins & ends.
791 * @param [in] actor The actor to animate.
792 * @param [in] scale The scale factor.
793 * @param [in] alpha The alpha function to apply.
795 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
798 * @brief Scale an actor.
800 * This overload allows the scaling start & end time to be customized.
801 * @pre delaySeconds must be zero or greater.
802 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
803 * @param [in] actor The actor to animate.
804 * @param [in] scale The scale factor.
805 * @param [in] alpha The alpha function to apply.
806 * @param [in] delaySeconds The initial delay from the start of the animation.
807 * @param [in] durationSeconds The duration of the scaling.
809 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
812 * @brief Scale an actor to a target scale factor.
814 * The default alpha function will be used.
815 * The scaling will start & end when the animation begins & ends.
816 * @param [in] actor The actor to animate.
817 * @param [in] x Target scale-factor in the X-direction.
818 * @param [in] y Target scale-factor in the Y-direction.
819 * @param [in] z Target scale-factor in the Z-direction.
821 void ScaleTo(Actor actor, float x, float y, float z);
824 * @brief Scale an actor to a target scale factor.
826 * This overload allows the alpha function to be customized.
827 * The scaling will start & end when the animation begins & ends.
828 * @param [in] actor The actor to animate.
829 * @param [in] scale The target scale factor.
830 * @param [in] alpha The alpha function to apply.
832 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
835 * @brief Scale an actor to a target scale factor.
837 * This overload allows the scaling start & end time to be customized.
838 * @pre delaySeconds must be zero or greater.
839 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
840 * @param [in] actor The actor to animate.
841 * @param [in] scale The target scale factor.
842 * @param [in] alpha The alpha function to apply.
843 * @param [in] delaySeconds The initial delay from the start of the animation.
844 * @param [in] durationSeconds The duration of the scaling.
846 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
849 * @brief Show an actor during the animation.
851 * @param [in] actor The actor to animate.
852 * @param [in] delaySeconds The initial delay from the start of the animation.
854 void Show(Actor actor, float delaySeconds);
857 * @brief Hide an actor during the animation.
859 * @param [in] actor The actor to animate.
860 * @param [in] delaySeconds The initial delay from the start of the animation.
862 void Hide(Actor actor, float delaySeconds);
865 * @brief Animate the opacity of an actor.
867 * The default alpha function will be used.
868 * The effect will start & end when the animation begins & ends.
869 * @param [in] actor The actor to animate.
870 * @param [in] opacity The relative change in opacity.
872 void OpacityBy(Actor actor, float opacity);
875 * @brief Animate the opacity of an actor.
877 * This overload allows the alpha function to be customized.
878 * The effect will start & end when the animation begins & ends.
879 * @param [in] actor The actor to animate.
880 * @param [in] opacity The relative change in opacity.
881 * @param [in] alpha The alpha function to apply.
883 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
886 * @brief Animate the opacity of an actor.
888 * This overload allows the animation start & end time to be customized.
889 * @pre delaySeconds must be zero or greater.
890 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
891 * @param [in] actor The actor to animate.
892 * @param [in] opacity The relative change in opacity.
893 * @param [in] alpha The alpha function to apply.
894 * @param [in] delaySeconds The initial delay from the start of the animation.
895 * @param [in] durationSeconds The duration of the opacity animation.
897 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
900 * @brief Animate an actor to a target opacity.
902 * The default alpha function will be used.
903 * The effect will start & end when the animation begins & ends.
904 * @param [in] actor The actor to animate.
905 * @param [in] opacity The target opacity.
907 void OpacityTo(Actor actor, float opacity);
910 * @brief Animate an actor to a target opacity.
912 * This overload allows the alpha function to be customized.
913 * The effect will start & end when the animation begins & ends.
914 * @param [in] actor The actor to animate.
915 * @param [in] opacity The target opacity.
916 * @param [in] alpha The alpha function to apply.
918 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
921 * @brief Animate an actor to a target opacity.
923 * This overload allows the animation start & end time to be customized.
924 * @pre delaySeconds must be zero or greater.
925 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
926 * @param [in] actor The actor to animate.
927 * @param [in] opacity The target opacity.
928 * @param [in] alpha The alpha function to apply.
929 * @param [in] delaySeconds The initial delay from the start of the animation.
930 * @param [in] durationSeconds The duration of the opacity animation.
932 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
935 * @brief Animate the color of an actor.
937 * The default alpha function will be used.
938 * The effect will start & end when the animation begins & ends.
939 * @param [in] actor The actor to animate.
940 * @param [in] color The relative change in color.
942 void ColorBy(Actor actor, Vector4 color);
945 * @brief Animate the color of an actor.
947 * This overload allows the alpha function to be customized.
948 * The effect will start & end when the animation begins & ends.
949 * @param [in] actor The actor to animate.
950 * @param [in] color The relative change in color.
951 * @param [in] alpha The alpha function to apply.
953 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
956 * @brief Animate the color of an actor.
958 * This overload allows the animation start & end time to be customized.
959 * @pre delaySeconds must be zero or greater.
960 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
961 * @param [in] actor The actor to animate.
962 * @param [in] color The relative change in color.
963 * @param [in] alpha The alpha function to apply.
964 * @param [in] delaySeconds The initial delay from the start of the animation.
965 * @param [in] durationSeconds The duration of the color animation.
967 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
970 * @brief Animate an actor to a target color.
972 * The default alpha function will be used.
973 * The effect will start & end when the animation begins & ends.
974 * @param [in] actor The actor to animate.
975 * @param [in] color The target color.
977 void ColorTo(Actor actor, Vector4 color);
980 * @brief Animate an actor to a target color.
982 * This overload allows the alpha function to be customized.
983 * The effect will start & end when the animation begins & ends.
984 * @param [in] actor The actor to animate.
985 * @param [in] color The target color.
986 * @param [in] alpha The alpha function to apply.
988 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
991 * @brief Animate an actor to a target color.
993 * This overload allows the animation start & end time to be customized.
994 * @pre delaySeconds must be zero or greater.
995 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
996 * @param [in] actor The actor to animate.
997 * @param [in] color The target color.
998 * @param [in] alpha The alpha function to apply.
999 * @param [in] delaySeconds The initial delay from the start of the animation.
1000 * @param [in] durationSeconds The duration of the color animation.
1002 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1005 * @brief Resize an actor.
1007 * The default alpha function will be used.
1008 * The resizing will start & end when the animation begins & ends.
1009 * The depth defaults to the minimum of width & height.
1010 * @param [in] actor The actor to animate.
1011 * @param [in] width The target width.
1012 * @param [in] height The target height.
1014 void Resize(Actor actor, float width, float height);
1017 * @brief Resize an actor.
1019 * This overload allows the alpha function to be customized.
1020 * The resizing will start & end when the animation begins & ends.
1021 * The depth defaults to the minimum of width & height.
1022 * @param [in] actor The actor to animate.
1023 * @param [in] width The target width.
1024 * @param [in] height The target height.
1025 * @param [in] alpha The alpha function to apply.
1027 void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1030 * @brief Resize an actor.
1032 * This overload allows the resizing start & end time to be customized.
1033 * The depth defaults to the minimum of width & height.
1034 * @pre delaySeconds must be zero or greater.
1035 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1036 * @param [in] actor The actor to animate.
1037 * @param [in] width The target width.
1038 * @param [in] height The target height.
1039 * @param [in] alpha The alpha function to apply.
1040 * @param [in] delaySeconds The initial delay from the start of the animation.
1041 * @param [in] durationSeconds The duration of the resizing.
1043 void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1046 * @brief Resize an actor.
1048 * The default alpha function will be used.
1049 * The resizing will start & end when the animation begins & ends.
1050 * @param [in] actor The actor to animate.
1051 * @param [in] size The target size.
1053 void Resize(Actor actor, Vector3 size);
1056 * @brief Resize an actor.
1058 * This overload allows the alpha function to be customized.
1059 * The resizing will start & end when the animation begins & ends.
1060 * @param [in] actor The actor to animate.
1061 * @param [in] size The target size.
1062 * @param [in] alpha The alpha function to apply.
1064 void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1067 * @brief Resize an actor.
1069 * This overload allows the resizing start & end time to be customized.
1070 * @pre delaySeconds must be zero or greater.
1071 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1072 * @param [in] actor The actor to animate.
1073 * @param [in] size The target size.
1074 * @param [in] alpha The alpha function to apply.
1075 * @param [in] delaySeconds The initial delay from the start of the animation.
1076 * @param [in] durationSeconds The duration of the resizing.
1078 void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1080 public: // Not intended for use by Application developers
1083 * @brief This constructor is used by Dali New() methods
1084 * @param [in] animation A pointer to a newly allocated Dali resource
1086 explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1091 * @brief Animate a property using a custom function.
1093 * @pre The property type is equal expectedType.
1094 * @param [in] target The target object/property to animate.
1095 * @param [in] targetType The expected type of the property.
1096 * @param [in] func The function to call during the animation.
1098 void Animate( Property target,
1099 Property::Type targetType,
1103 * @brief Animate a property using a custom function.
1105 * @pre The property type is equal expectedType.
1106 * @param [in] target The target object/property to animate.
1107 * @param [in] targetType The expected type of the property.
1108 * @param [in] func The function to call during the animation.
1109 * @param [in] alpha The alpha function to apply.
1111 void Animate( Property target,
1112 Property::Type targetType,
1114 AlphaFunction alpha );
1117 * @brief Animate a property using a custom function.
1119 * @pre The property type is equal expectedType.
1120 * @param [in] target The target object/property to animate.
1121 * @param [in] targetType The expected type of the property.
1122 * @param [in] func The function to call during the animation.
1123 * @param [in] period The effect will occur during this time period.
1125 void Animate( Property target,
1126 Property::Type targetType,
1128 TimePeriod period );
1131 * @brief Animate a property using a custom function.
1133 * @pre The property type is equal expectedType.
1134 * @param [in] target The target object/property to animate.
1135 * @param [in] targetType The expected type of the property.
1136 * @param [in] func The function to call during the animation.
1137 * @param [in] alpha The alpha function to apply.
1138 * @param [in] period The effect will occur during this time period.
1140 void Animate( Property target,
1141 Property::Type targetType,
1143 AlphaFunction alpha,
1144 TimePeriod period );
1149 #endif // __DALI_ANIMATION_H__