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<Vector2 (float alpha, const Vector2& current)> AnimatorFunctionVector2; ///< Animator function signature for Vector2 properties.
49 typedef boost::function<Vector3 (float alpha, const Vector3& current)> AnimatorFunctionVector3; ///< Animator function signature for Vector3 properties.
50 typedef boost::function<Vector4 (float alpha, const Vector4& current)> AnimatorFunctionVector4; ///< Animator function signature for Vector4 properties.
51 typedef boost::function<Quaternion (float alpha, const Quaternion& current)> AnimatorFunctionQuaternion;///< Animator function signature for Quaternion properties.
53 namespace Internal DALI_INTERNAL
59 * @brief Dali::Animation can be used to animate the properties of any number of objects, typically Actors.
61 * An example animation setup is shown below:
67 * Actor mActor; // The object we wish to animate
68 * Animation mAnimation; // Keep this to control the animation
71 * // ...To play the animation
73 * mAnimation = Animation::New(3.0f); // duration 3 seconds
74 * mAnimation.MoveTo(mActor, 10.0f, 50.0f, 0.0f);
79 * Dali::Animation supports "fire and forget" behaviour i.e. an animation continues to play if the handle is discarded.
80 * Note that in the following example, the "Finish" signal will be emitted:
84 * void ExampleCallback( Animation& source )
86 * std::cout << "Animation has finished" << std::endl;
89 * void ExampleAnimation( Actor actor )
91 * Animation animation = Animation::New(2.0f); // duration 2 seconds
92 * animation.MoveTo(actor, 10.0f, 50.0f, 0.0f);
93 * animation.SignalFinished().Connect( ExampleCallback );
95 * } // At this point the animation handle has gone out of scope
97 * Actor actor = Actor::New();
98 * Stage::GetCurrent().Add( actor );
100 * // Fire animation and forget about it
101 * ExampleAnimation( actor );
103 * // However the animation will continue, and "Animation has finished" will be printed after 2 seconds.
107 * If the "Finish" signal is connected to a member function of an object, it must be disconnected before the object is destroyed.
108 * This is typically done in the object destructor, and requires either the Dali::Connection object or Dali::Animation handle to be stored.
110 class DALI_IMPORT_API Animation : public BaseHandle
114 typedef SignalV2< void (Animation&) > AnimationSignalV2; ///< Animation finished signal type
116 typedef Any AnyFunction; ///< Interpolation function
117 typedef boost::function<Vector3 (float alpha, const Vector3& current)> Vector3AnimatorFunc; ///< Interpolation function
118 typedef boost::function<Quaternion (float alpha, const Quaternion& current)> QuaternionAnimatorFunc; ///< Interpolation function
121 * @brief What to do when the animation ends, is stopped or is destroyed
125 Bake, ///< When the animation ends, the animated property values are saved.
126 Discard, ///< When the animation ends, the animated property values are forgotten.
127 BakeFinal ///< If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Bake.
131 static const char* const SIGNAL_FINISHED; ///< name "finished"
134 static const char* const ACTION_PLAY; ///< name "play"
135 static const char* const ACTION_STOP; ///< name "stop"
136 static const char* const ACTION_PAUSE; ///< name "pause"
139 * @brief Create an uninitialized Animation; this can be initialized with Animation::New().
141 * Calling member functions with an uninitialized Dali::Object is not allowed.
146 * @brief Create an initialized Animation.
148 * The animation will not loop.
149 * The default end action is "Bake".
150 * The default alpha function is linear.
151 * @pre durationSeconds must be greater than zero.
152 * @param [in] durationSeconds The duration in seconds.
153 * @return A handle to a newly allocated Dali resource.
155 static Animation New(float durationSeconds);
158 * @brief Downcast an Object handle to Animation.
160 * If handle points to an Animation object the downcast produces
161 * valid handle. If not the returned handle is left uninitialized.
163 * @param[in] handle to An object
164 * @return handle to a Animation object or an uninitialized handle
166 static Animation DownCast( BaseHandle handle );
171 * This is non-virtual since derived Handle types must not contain data or virtual methods.
176 * @copydoc Dali::BaseHandle::operator=
178 using BaseHandle::operator=;
181 * @brief Set the duration of an animation.
183 * @pre durationSeconds must be greater than zero.
184 * @param[in] seconds The duration in seconds.
186 void SetDuration(float seconds);
189 * @brief Retrieve the duration of an animation.
191 * @return The duration in seconds.
193 float GetDuration() const;
196 * @brief Set whether the animation will loop.
198 * @param[in] looping True if the animation will loop.
200 void SetLooping(bool looping);
203 * @brief Query whether the animation will loop.
205 * @return True if the animation will loop.
207 bool IsLooping() const;
210 * @brief Set the end action of the animation.
212 * This action is performed when the animation ends.
213 * Default end action is bake
214 * @param[in] action The end action.
216 void SetEndAction(EndAction action);
219 * @brief Returns the end action of the animation.
221 * @return The end action.
223 EndAction GetEndAction() const;
226 * @brief Set the destroy action of the animation.
228 * If the animation is destroyed this action is performed on the following update.
229 * Default destroy action is bake
230 * @param[in] action The destroy action.
232 void SetDestroyAction(EndAction action);
235 * @brief Returns the destroy action of the animation.
237 * @return The destroy action.
239 EndAction GetDestroyAction() const;
242 * @brief Set the default alpha function for an animation.
244 * This is applied to individual property animations, if no further alpha functions are supplied.
245 * @param[in] alpha The default alpha function.
247 void SetDefaultAlphaFunction(AlphaFunction alpha);
250 * @brief Retrieve the default alpha function for an animation.
252 * @return The default alpha function.
254 AlphaFunction GetDefaultAlphaFunction() const;
257 * @brief Retrieve the current progress of the animation.
259 * @return The current progress as a normalized value between [0,1].
261 float GetCurrentProgress();
264 * @brief Sets the progress of the animation.
265 * The animation will play (or continue playing) from this point
267 * @param[in] progress The new progress as a normalized value between [0,1].
269 void SetCurrentProgress( float progress );
272 * @brief Play the animation.
277 * @brief Play the animation from a given point.
278 * @param[in] progress A value between [0,1] form where the animation should start playing
280 void PlayFrom( float progress );
283 * @brief Pause the animation.
288 * @brief Stop the animation.
293 * @brief Clear the animation.
295 * This disconnects any objects that were being animated, effectively stopping the animation.
300 * @brief Connect to this signal to be notified when an Animation's animations have finished.
302 * @return A signal object to Connect() with.
304 AnimationSignalV2& FinishedSignal();
307 * @brief Animate a property value by a relative amount.
309 * The default alpha function will be used.
310 * The effect will start & end when the animation begins & ends.
311 * @param [in] target The target object/property to animate.
312 * @param [in] relativeValue The property value will change by this amount.
314 void AnimateBy(Property target, Property::Value relativeValue);
317 * @brief Animate a property value by a relative amount.
319 * The effect will start & end when the animation begins & ends.
320 * @param [in] target The target object/property to animate.
321 * @param [in] relativeValue The property value will change by this amount.
322 * @param [in] alpha The alpha function to apply.
324 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
327 * @brief Animate a property value by a relative amount.
329 * The default alpha function will be used.
330 * @param [in] target The target object/property to animate.
331 * @param [in] relativeValue The property value will increase/decrease by this amount.
332 * @param [in] period The effect will occur during this time period.
334 void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
337 * @brief Animate a property value by a relative amount.
339 * @param [in] target The target object/property to animate.
340 * @param [in] relativeValue The property value will increase/decrease by this amount.
341 * @param [in] alpha The alpha function to apply.
342 * @param [in] period The effect will occur during this time period.
344 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
347 * @brief Animate a property to a destination value.
349 * The default alpha function will be used.
350 * The effect will start & end when the animation begins & ends.
351 * @param [in] target The target object/property to animate.
352 * @param [in] destinationValue The destination value.
354 void AnimateTo(Property target, Property::Value destinationValue);
357 * @brief Animate a property to a destination value.
359 * The effect will start & end when the animation begins & ends.
360 * @param [in] target The target object/property to animate.
361 * @param [in] destinationValue The destination value.
362 * @param [in] alpha The alpha function to apply.
364 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
367 * @brief Animate a property to a destination value.
369 * The default alpha function will be used.
370 * @param [in] target The target object/property to animate.
371 * @param [in] destinationValue The destination value.
372 * @param [in] period The effect will occur during this time period.
374 void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
377 * @brief Animate a property to a destination value.
379 * @param [in] target The target object/property to animate.
380 * @param [in] destinationValue The destination value.
381 * @param [in] alpha The alpha function to apply.
382 * @param [in] period The effect will occur during this time period.
384 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
387 * @brief Animate a property between keyframes.
389 * @param [in] target The target object/property to animate.
390 * @param [in] keyFrames The key frames
392 void AnimateBetween(Property target, KeyFrames& keyFrames);
395 * @brief Animate a property between keyframes.
397 * @param [in] target The target object/property to animate.
398 * @param [in] keyFrames The key frames
399 * @param [in] alpha The alpha function to apply.
401 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
404 * @brief Animate a property between keyframes.
406 * @param [in] target The target object/property to animate.
407 * @param [in] keyFrames The key frames
408 * @param [in] period The effect will occur during this time period.
410 void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
413 * @brief Animate a property between keyframes.
415 * @param [in] target The target object/property to animate.
416 * @param [in] keyFrames The key frames
417 * @param [in] alpha The alpha function to apply.
418 * @param [in] period The effect will occur during this time period.
420 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
423 * @brief Animate a property using a custom function.
425 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
426 * @pre The property type is equal PropertyTypes::Get<P>().
427 * @param [in] target The target object/property to animate.
428 * @param [in] animatorFunc The function to call during the animation.
431 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc )
433 Animate( target, PropertyTypes::Get<P>(), animatorFunc );
437 * @brief Animate a property using a custom function.
439 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
440 * @pre The property type is equal PropertyTypes::Get<P>().
441 * @param [in] target The target object/property to animate.
442 * @param [in] animatorFunc The function to call during the animation.
443 * @param [in] alpha The alpha function to apply.
446 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha )
448 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha );
452 * @brief Animate a property using a custom function.
454 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
455 * @pre The property type is equal PropertyTypes::Get<P>().
456 * @param [in] target The target object/property to animate.
457 * @param [in] animatorFunc The function to call during the animation.
458 * @param [in] period The effect will occur during this time period.
461 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, TimePeriod period )
463 Animate( target, PropertyTypes::Get<P>(), animatorFunc, period );
467 * @brief Animate a property using a custom function.
469 * The function will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
470 * @pre The property type is equal PropertyTypes::Get<P>().
471 * @param [in] target The target object/property to animate.
472 * @param [in] animatorFunc The function to call during the animation.
473 * @param [in] alpha The alpha function to apply.
474 * @param [in] period The effect will occur during this time period.
477 void Animate( Property target, boost::function<P (float alpha, const P& current)> animatorFunc, AlphaFunction alpha, TimePeriod period )
479 Animate( target, PropertyTypes::Get<P>(), animatorFunc, alpha, period );
482 // Actor-specific convenience methods
485 * @brief Move an actor relative to its position.
487 * The default alpha function will be used.
488 * The move will start & end when the animation begins & ends.
489 * @param [in] actor The actor to animate.
490 * @param [in] x axis displacement.
491 * @param [in] y axis displacement.
492 * @param [in] z axis displacement.
494 void MoveBy(Actor actor, float x, float y, float z);
497 * @brief Move an actor relative to its position.
499 * This overload allows the alpha function to be customized.
500 * The move will start & end when the animation begins & ends.
501 * @param [in] actor The actor to animate.
502 * @param [in] displacement relative to current position.
503 * @param [in] alpha The alpha function to apply.
505 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
508 * @brief Move an actor relative to its position.
510 * This overload allows the translation start & end time to be customized.
511 * @pre delaySeconds must be zero or greater.
512 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
513 * @param [in] actor The actor to animate.
514 * @param [in] displacement relative to current position.
515 * @param [in] alpha The alpha function to apply.
516 * @param [in] delaySeconds The initial delay from the start of the animation.
517 * @param [in] durationSeconds The duration of the translation.
519 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
522 * @brief Move an actor to a target position.
524 * The default alpha function will be used.
525 * The move will start & end when the animation begins & ends.
526 * @param [in] actor The actor to animate.
527 * @param [in] x axis position.
528 * @param [in] y axis position.
529 * @param [in] z axis position.
531 void MoveTo(Actor actor, float x, float y, float z);
534 * @brief Move an actor to a target position.
536 * This overload allows the alpha function to be customized.
537 * The move will start & end when the animation begins & ends.
538 * @param [in] actor The actor to animate.
539 * @param [in] position to move to
540 * @param [in] alpha The alpha function to apply.
542 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
545 * @brief Move an actor to a target position.
547 * This overload allows the translation start & end time to be customized.
548 * @pre delaySeconds must be zero or greater.
549 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
550 * @param [in] actor The actor to animate.
551 * @param [in] position to move to
552 * @param [in] alpha The alpha function to apply.
553 * @param [in] delaySeconds The initial delay from the start of the animation.
554 * @param [in] durationSeconds The duration of the translation.
556 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
559 * @brief Move an actor using a custom function.
561 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
562 * @pre delaySeconds must be zero or greater.
563 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
564 * @param [in] actor The actor to animate.
565 * @param [in] animatorFunc The function to call during the animation.
566 * @param [in] alpha The alpha function to apply.
567 * @param [in] delaySeconds The initial delay from the start of the animation.
568 * @param [in] durationSeconds The duration of the translation.
570 void Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
573 * @brief Rotate an actor around an arbitrary axis.
575 * The default alpha function will be used.
576 * The rotation will start & end when the animation begins & ends.
577 * @param [in] actor The actor to animate.
578 * @param [in] angle The angle in degrees.
579 * @param [in] axis The axis to rotate around
581 void RotateBy(Actor actor, Degree angle, Vector3 axis);
584 * @brief Rotate an actor around an arbitrary axis.
586 * The default alpha function will be used.
587 * The rotation will start & end when the animation begins & ends.
588 * @param [in] actor The actor to animate.
589 * @param [in] angle The angle in radians.
590 * @param [in] axis The axis to rotate around
592 void RotateBy(Actor actor, Radian angle, Vector3 axis);
595 * @brief Rotate an actor around an arbitrary axis.
597 * This overload allows the alpha function to be customized.
598 * The rotation will start & end when the animation begins & ends.
599 * @param [in] actor The actor to animate.
600 * @param [in] angle The angle in radians.
601 * @param [in] axis The axis to rotate around.
602 * @param [in] alpha The alpha function to apply.
604 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
607 * @brief Rotate an actor around an arbitrary axis.
609 * This overload allows the alpha function to be customized.
610 * The rotation will start & end when the animation begins & ends.
611 * @param [in] actor The actor to animate.
612 * @param [in] angle The angle in radians.
613 * @param [in] axis The axis to rotate around.
614 * @param [in] alpha The alpha function to apply.
616 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
619 * @brief Rotate an actor around an arbitrary axis.
621 * This overload allows the rotation start & end time to be customized.
622 * @pre delaySeconds must be zero or greater.
623 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
624 * @param [in] actor The actor to animate.
625 * @param [in] angle The angle in degrees.
626 * @param [in] axis The axis to rotate around
627 * @param [in] alpha The alpha function to apply.
628 * @param [in] delaySeconds The initial delay from the start of the animation.
629 * @param [in] durationSeconds The duration of the rotation.
631 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
634 * @brief Rotate an actor around an arbitrary axis.
636 * This overload allows the rotation start & end time to be customized.
637 * @pre delaySeconds must be zero or greater.
638 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
639 * @param [in] actor The actor to animate.
640 * @param [in] angle The angle in radians.
641 * @param [in] axis The axis to rotate around
642 * @param [in] alpha The alpha function to apply.
643 * @param [in] delaySeconds The initial delay from the start of the animation.
644 * @param [in] durationSeconds The duration of the rotation.
646 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
649 * @brief Rotate an actor to a target orientation.
651 * The default alpha function will be used.
652 * The rotation will start & end when the animation begins & ends.
653 * @param [in] actor The actor to animate.
654 * @param [in] angle The target rotation angle in degrees.
655 * @param [in] axis The target axis of rotation.
657 void RotateTo(Actor actor, Degree angle, Vector3 axis);
660 * @brief Rotate an actor to a target orientation.
662 * The default alpha function will be used.
663 * The rotation will start & end when the animation begins & ends.
664 * @param [in] actor The actor to animate.
665 * @param [in] angle The target rotation angle in radians.
666 * @param [in] axis The target axis of rotation.
668 void RotateTo(Actor actor, Radian angle, Vector3 axis);
671 * @brief Rotate an actor to a target orientation.
673 * The default alpha function will be used.
674 * The rotation will start & end when the animation begins & ends.
675 * @param [in] actor The actor to animate.
676 * @param [in] orientation The target orientation.
678 void RotateTo(Actor actor, Quaternion orientation);
681 * @brief Rotate an actor to a target orientation.
683 * This overload allows the alpha function to be customized.
684 * The rotation will start & end when the animation begins & ends.
685 * @param [in] actor The actor to animate.
686 * @param [in] angle The target rotation angle in degrees.
687 * @param [in] axis The target axis of rotation.
688 * @param [in] alpha The alpha function to apply.
690 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
693 * @brief Rotate an actor to a target orientation.
695 * This overload allows the alpha function to be customized.
696 * The rotation will start & end when the animation begins & ends.
697 * @param [in] actor The actor to animate.
698 * @param [in] angle The target rotation angle in radians.
699 * @param [in] axis The target axis of rotation.
700 * @param [in] alpha The alpha function to apply.
702 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
705 * @brief Rotate an actor to a target orientation.
707 * This overload allows the alpha function to be customized.
708 * The rotation will start & end when the animation begins & ends.
709 * @param [in] actor The actor to animate.
710 * @param [in] orientation The target orientation.
711 * @param [in] alpha The alpha function to apply.
713 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
716 * @brief Rotate an actor to a target orientation.
718 * This overload allows the rotation start & end time to be customized.
719 * @pre delaySeconds must be zero or greater.
720 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
721 * @param [in] actor The actor to animate.
722 * @param [in] angle The target rotation angle in degrees.
723 * @param [in] axis The target axis of rotation.
724 * @param [in] alpha The alpha function to apply.
725 * @param [in] delaySeconds The initial delay from the start of the animation.
726 * @param [in] durationSeconds The duration of the rotation.
728 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
731 * @brief Rotate an actor to a target orientation.
733 * This overload allows the rotation start & end time to be customized.
734 * @pre delaySeconds must be zero or greater.
735 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
736 * @param [in] actor The actor to animate.
737 * @param [in] angle The target rotation angle in radians.
738 * @param [in] axis The target axis of rotation.
739 * @param [in] alpha The alpha function to apply.
740 * @param [in] delaySeconds The initial delay from the start of the animation.
741 * @param [in] durationSeconds The duration of the rotation.
743 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
746 * @brief Rotate an actor to a target orientation.
748 * This overload allows the rotation start & end time to be customized.
749 * @pre delaySeconds must be zero or greater.
750 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
751 * @param [in] actor The actor to animate.
752 * @param [in] orientation The target orientation.
753 * @param [in] alpha The alpha function to apply.
754 * @param [in] delaySeconds The initial delay from the start of the animation.
755 * @param [in] durationSeconds The duration of the rotation.
757 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
760 * @brief Rotate an actor using a custom function.
762 * The animatorFunc will be called from a separate animation-thread; it should return quickly, to avoid performance degredation.
763 * @pre delaySeconds must be zero or greater.
764 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
765 * @param [in] actor The actor to animate.
766 * @param [in] animatorFunc The function to call during the animation.
767 * @param [in] alpha The alpha function to apply.
768 * @param [in] delaySeconds The initial delay from the start of the animation.
769 * @param [in] durationSeconds The duration of the rotation.
771 void Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds);
774 * @brief Scale an actor.
776 * The default alpha function will be used.
777 * The scaling will start & end when the animation begins & ends.
778 * @param [in] actor The actor to animate.
779 * @param [in] x Scale factor in the X-direction.
780 * @param [in] y Scale factor in the Y-direction.
781 * @param [in] z Scale factor in the Z-direction.
783 void ScaleBy(Actor actor, float x, float y, float z);
786 * @brief Scale an actor.
788 * This overload allows the alpha function to be customized.
789 * The scaling will start & end when the animation begins & ends.
790 * @param [in] actor The actor to animate.
791 * @param [in] scale The scale factor.
792 * @param [in] alpha The alpha function to apply.
794 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
797 * @brief Scale an actor.
799 * This overload allows the scaling start & end time to be customized.
800 * @pre delaySeconds must be zero or greater.
801 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
802 * @param [in] actor The actor to animate.
803 * @param [in] scale The scale factor.
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 scaling.
808 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
811 * @brief Scale an actor to a target scale factor.
813 * The default alpha function will be used.
814 * The scaling will start & end when the animation begins & ends.
815 * @param [in] actor The actor to animate.
816 * @param [in] x Target scale-factor in the X-direction.
817 * @param [in] y Target scale-factor in the Y-direction.
818 * @param [in] z Target scale-factor in the Z-direction.
820 void ScaleTo(Actor actor, float x, float y, float z);
823 * @brief Scale an actor to a target scale factor.
825 * This overload allows the alpha function to be customized.
826 * The scaling will start & end when the animation begins & ends.
827 * @param [in] actor The actor to animate.
828 * @param [in] scale The target scale factor.
829 * @param [in] alpha The alpha function to apply.
831 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
834 * @brief Scale an actor to a target scale factor.
836 * This overload allows the scaling start & end time to be customized.
837 * @pre delaySeconds must be zero or greater.
838 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
839 * @param [in] actor The actor to animate.
840 * @param [in] scale The target scale factor.
841 * @param [in] alpha The alpha function to apply.
842 * @param [in] delaySeconds The initial delay from the start of the animation.
843 * @param [in] durationSeconds The duration of the scaling.
845 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
848 * @brief Show an actor during the animation.
850 * @param [in] actor The actor to animate.
851 * @param [in] delaySeconds The initial delay from the start of the animation.
853 void Show(Actor actor, float delaySeconds);
856 * @brief Hide an actor during the animation.
858 * @param [in] actor The actor to animate.
859 * @param [in] delaySeconds The initial delay from the start of the animation.
861 void Hide(Actor actor, float delaySeconds);
864 * @brief Animate the opacity of an actor.
866 * The default alpha function will be used.
867 * The effect will start & end when the animation begins & ends.
868 * @param [in] actor The actor to animate.
869 * @param [in] opacity The relative change in opacity.
871 void OpacityBy(Actor actor, float opacity);
874 * @brief Animate the opacity of an actor.
876 * This overload allows the alpha function to be customized.
877 * The effect will start & end when the animation begins & ends.
878 * @param [in] actor The actor to animate.
879 * @param [in] opacity The relative change in opacity.
880 * @param [in] alpha The alpha function to apply.
882 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
885 * @brief Animate the opacity of an actor.
887 * This overload allows the animation start & end time to be customized.
888 * @pre delaySeconds must be zero or greater.
889 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
890 * @param [in] actor The actor to animate.
891 * @param [in] opacity The relative change in opacity.
892 * @param [in] alpha The alpha function to apply.
893 * @param [in] delaySeconds The initial delay from the start of the animation.
894 * @param [in] durationSeconds The duration of the opacity animation.
896 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
899 * @brief Animate an actor to a target opacity.
901 * The default alpha function will be used.
902 * The effect will start & end when the animation begins & ends.
903 * @param [in] actor The actor to animate.
904 * @param [in] opacity The target opacity.
906 void OpacityTo(Actor actor, float opacity);
909 * @brief Animate an actor to a target opacity.
911 * This overload allows the alpha function to be customized.
912 * The effect will start & end when the animation begins & ends.
913 * @param [in] actor The actor to animate.
914 * @param [in] opacity The target opacity.
915 * @param [in] alpha The alpha function to apply.
917 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
920 * @brief Animate an actor to a target opacity.
922 * This overload allows the animation start & end time to be customized.
923 * @pre delaySeconds must be zero or greater.
924 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
925 * @param [in] actor The actor to animate.
926 * @param [in] opacity The target opacity.
927 * @param [in] alpha The alpha function to apply.
928 * @param [in] delaySeconds The initial delay from the start of the animation.
929 * @param [in] durationSeconds The duration of the opacity animation.
931 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
934 * @brief Animate the color of an actor.
936 * The default alpha function will be used.
937 * The effect will start & end when the animation begins & ends.
938 * @param [in] actor The actor to animate.
939 * @param [in] color The relative change in color.
941 void ColorBy(Actor actor, Vector4 color);
944 * @brief Animate the color of an actor.
946 * This overload allows the alpha function to be customized.
947 * The effect will start & end when the animation begins & ends.
948 * @param [in] actor The actor to animate.
949 * @param [in] color The relative change in color.
950 * @param [in] alpha The alpha function to apply.
952 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
955 * @brief Animate the color of an actor.
957 * This overload allows the animation start & end time to be customized.
958 * @pre delaySeconds must be zero or greater.
959 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
960 * @param [in] actor The actor to animate.
961 * @param [in] color The relative change in color.
962 * @param [in] alpha The alpha function to apply.
963 * @param [in] delaySeconds The initial delay from the start of the animation.
964 * @param [in] durationSeconds The duration of the color animation.
966 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
969 * @brief Animate an actor to a target color.
971 * The default alpha function will be used.
972 * The effect will start & end when the animation begins & ends.
973 * @param [in] actor The actor to animate.
974 * @param [in] color The target color.
976 void ColorTo(Actor actor, Vector4 color);
979 * @brief Animate an actor to a target color.
981 * This overload allows the alpha function to be customized.
982 * The effect will start & end when the animation begins & ends.
983 * @param [in] actor The actor to animate.
984 * @param [in] color The target color.
985 * @param [in] alpha The alpha function to apply.
987 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
990 * @brief Animate an actor to a target color.
992 * This overload allows the animation start & end time to be customized.
993 * @pre delaySeconds must be zero or greater.
994 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
995 * @param [in] actor The actor to animate.
996 * @param [in] color The target color.
997 * @param [in] alpha The alpha function to apply.
998 * @param [in] delaySeconds The initial delay from the start of the animation.
999 * @param [in] durationSeconds The duration of the color animation.
1001 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1004 * @brief Resize an actor.
1006 * The default alpha function will be used.
1007 * The resizing will start & end when the animation begins & ends.
1008 * The depth defaults to the minimum of width & height.
1009 * @param [in] actor The actor to animate.
1010 * @param [in] width The target width.
1011 * @param [in] height The target height.
1013 void Resize(Actor actor, float width, float height);
1016 * @brief Resize an actor.
1018 * This overload allows the alpha function to be customized.
1019 * The resizing will start & end when the animation begins & ends.
1020 * The depth defaults to the minimum of width & height.
1021 * @param [in] actor The actor to animate.
1022 * @param [in] width The target width.
1023 * @param [in] height The target height.
1024 * @param [in] alpha The alpha function to apply.
1026 void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1029 * @brief Resize an actor.
1031 * This overload allows the resizing start & end time to be customized.
1032 * The depth defaults to the minimum of width & height.
1033 * @pre delaySeconds must be zero or greater.
1034 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1035 * @param [in] actor The actor to animate.
1036 * @param [in] width The target width.
1037 * @param [in] height The target height.
1038 * @param [in] alpha The alpha function to apply.
1039 * @param [in] delaySeconds The initial delay from the start of the animation.
1040 * @param [in] durationSeconds The duration of the resizing.
1042 void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1045 * @brief Resize an actor.
1047 * The default alpha function will be used.
1048 * The resizing will start & end when the animation begins & ends.
1049 * @param [in] actor The actor to animate.
1050 * @param [in] size The target size.
1052 void Resize(Actor actor, Vector3 size);
1055 * @brief Resize an actor.
1057 * This overload allows the alpha function to be customized.
1058 * The resizing will start & end when the animation begins & ends.
1059 * @param [in] actor The actor to animate.
1060 * @param [in] size The target size.
1061 * @param [in] alpha The alpha function to apply.
1063 void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1066 * @brief Resize an actor.
1068 * This overload allows the resizing start & end time to be customized.
1069 * @pre delaySeconds must be zero or greater.
1070 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1071 * @param [in] actor The actor to animate.
1072 * @param [in] size The target size.
1073 * @param [in] alpha The alpha function to apply.
1074 * @param [in] delaySeconds The initial delay from the start of the animation.
1075 * @param [in] durationSeconds The duration of the resizing.
1077 void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1079 public: // Not intended for use by Application developers
1082 * @brief This constructor is used by Dali New() methods
1083 * @param [in] animation A pointer to a newly allocated Dali resource
1085 explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1090 * @brief Animate a property using a custom function.
1092 * @pre The property type is equal expectedType.
1093 * @param [in] target The target object/property to animate.
1094 * @param [in] targetType The expected type of the property.
1095 * @param [in] func The function to call during the animation.
1097 void Animate( Property target,
1098 Property::Type targetType,
1102 * @brief Animate a property using a custom function.
1104 * @pre The property type is equal expectedType.
1105 * @param [in] target The target object/property to animate.
1106 * @param [in] targetType The expected type of the property.
1107 * @param [in] func The function to call during the animation.
1108 * @param [in] alpha The alpha function to apply.
1110 void Animate( Property target,
1111 Property::Type targetType,
1113 AlphaFunction alpha );
1116 * @brief Animate a property using a custom function.
1118 * @pre The property type is equal expectedType.
1119 * @param [in] target The target object/property to animate.
1120 * @param [in] targetType The expected type of the property.
1121 * @param [in] func The function to call during the animation.
1122 * @param [in] period The effect will occur during this time period.
1124 void Animate( Property target,
1125 Property::Type targetType,
1127 TimePeriod period );
1130 * @brief Animate a property using a custom function.
1132 * @pre The property type is equal expectedType.
1133 * @param [in] target The target object/property to animate.
1134 * @param [in] targetType The expected type of the property.
1135 * @param [in] func The function to call during the animation.
1136 * @param [in] alpha The alpha function to apply.
1137 * @param [in] period The effect will occur during this time period.
1139 void Animate( Property target,
1140 Property::Type targetType,
1142 AlphaFunction alpha,
1143 TimePeriod period );
1148 #endif // __DALI_ANIMATION_H__