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 <dali/public-api/animation/alpha-functions.h>
23 #include <dali/public-api/animation/key-frames.h>
24 #include <dali/public-api/animation/path.h>
25 #include <dali/public-api/animation/time-period.h>
26 #include <dali/public-api/object/any.h>
27 #include <dali/public-api/object/handle.h>
28 #include <dali/public-api/object/property.h>
29 #include <dali/public-api/signals/dali-signal-v2.h>
44 namespace Internal DALI_INTERNAL
50 * @brief Dali::Animation can be used to animate the properties of any number of objects, typically Actors.
52 * An example animation setup is shown below:
58 * Actor mActor; // The object we wish to animate
59 * Animation mAnimation; // Keep this to control the animation
62 * // ...To play the animation
64 * mAnimation = Animation::New(3.0f); // duration 3 seconds
65 * mAnimation.MoveTo(mActor, 10.0f, 50.0f, 0.0f);
70 * Dali::Animation supports "fire and forget" behaviour i.e. an animation continues to play if the handle is discarded.
71 * Note that in the following example, the "Finish" signal will be emitted:
75 * void ExampleCallback( Animation& source )
77 * std::cout << "Animation has finished" << std::endl;
80 * void ExampleAnimation( Actor actor )
82 * Animation animation = Animation::New(2.0f); // duration 2 seconds
83 * animation.MoveTo(actor, 10.0f, 50.0f, 0.0f);
84 * animation.FinishedSignal().Connect( ExampleCallback );
86 * } // At this point the animation handle has gone out of scope
88 * Actor actor = Actor::New();
89 * Stage::GetCurrent().Add( actor );
91 * // Fire animation and forget about it
92 * ExampleAnimation( actor );
94 * // However the animation will continue, and "Animation has finished" will be printed after 2 seconds.
98 * If the "Finish" signal is connected to a member function of an object, it must be disconnected before the object is destroyed.
99 * This is typically done in the object destructor, and requires either the Dali::Connection object or Dali::Animation handle to be stored.
101 class DALI_IMPORT_API Animation : public BaseHandle
105 typedef SignalV2< void (Animation&) > AnimationSignalV2; ///< Animation finished signal type
107 typedef Any AnyFunction; ///< Interpolation function
110 * @brief What to do when the animation ends, is stopped or is destroyed
114 Bake, ///< When the animation ends, the animated property values are saved.
115 Discard, ///< When the animation ends, the animated property values are forgotten.
116 BakeFinal ///< If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Bake.
120 static const char* const SIGNAL_FINISHED; ///< name "finished"
123 static const char* const ACTION_PLAY; ///< name "play"
124 static const char* const ACTION_STOP; ///< name "stop"
125 static const char* const ACTION_PAUSE; ///< name "pause"
128 * @brief Create an uninitialized Animation; this can be initialized with Animation::New().
130 * Calling member functions with an uninitialized Dali::Object is not allowed.
135 * @brief Create an initialized Animation.
137 * The animation will not loop.
138 * The default end action is "Bake".
139 * The default alpha function is linear.
140 * @pre durationSeconds must be greater than zero.
141 * @param [in] durationSeconds The duration in seconds.
142 * @return A handle to a newly allocated Dali resource.
144 static Animation New(float durationSeconds);
147 * @brief Downcast an Object handle to Animation.
149 * If handle points to an Animation object the downcast produces
150 * valid handle. If not the returned handle is left uninitialized.
152 * @param[in] handle to An object
153 * @return handle to a Animation object or an uninitialized handle
155 static Animation DownCast( BaseHandle handle );
160 * This is non-virtual since derived Handle types must not contain data or virtual methods.
165 * @brief This copy constructor is required for (smart) pointer semantics.
167 * @param [in] handle A reference to the copied handle
169 Animation(const Animation& handle);
172 * @brief This assignment operator is required for (smart) pointer semantics.
174 * @param [in] rhs A reference to the copied handle
175 * @return A reference to this
177 Animation& operator=(const Animation& rhs);
180 * @brief Set the duration of an animation.
182 * @pre durationSeconds must be greater than zero.
183 * @param[in] seconds The duration in seconds.
185 void SetDuration(float seconds);
188 * @brief Retrieve the duration of an animation.
190 * @return The duration in seconds.
192 float GetDuration() const;
195 * @brief Set whether the animation will loop.
197 * @param[in] looping True if the animation will loop.
199 void SetLooping(bool looping);
202 * @brief Query whether the animation will loop.
204 * @return True if the animation will loop.
206 bool IsLooping() const;
209 * @brief Set the end action of the animation.
211 * This action is performed when the animation ends or if it is stopped.
212 * Default end action is bake
213 * @param[in] action The end action.
215 void SetEndAction(EndAction action);
218 * @brief Returns the end action of the animation.
220 * @return The end action.
222 EndAction GetEndAction() const;
225 * @brief Set the disconnect action.
227 * If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.
228 * Default action is to BakeFinal.
229 * @param[in] disconnectAction The disconnect action.
231 void SetDisconnectAction( EndAction disconnectAction );
234 * @brief Returns the disconnect action.
236 * @return The disconnect action.
238 EndAction GetDisconnectAction() const;
241 * @brief Set the default alpha function for an animation.
243 * This is applied to individual property animations, if no further alpha functions are supplied.
244 * @param[in] alpha The default alpha function.
246 void SetDefaultAlphaFunction(AlphaFunction alpha);
249 * @brief Retrieve the default alpha function for an animation.
251 * @return The default alpha function.
253 AlphaFunction GetDefaultAlphaFunction() const;
256 * @brief Sets the progress of the animation.
257 * The animation will play (or continue playing) from this point. The progress
258 * must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
259 * otherwise, it will be ignored.
261 * @param[in] progress The new progress as a normalized value between [0,1] or between the
262 * play range if specified.
264 void SetCurrentProgress( float progress );
267 * @brief Retrieve the current progress of the animation.
269 * @return The current progress as a normalized value between [0,1].
271 float GetCurrentProgress();
274 * @brief Specifies an speed factor for the animation.
276 * The speed factor is a multiplier of the normal velocity of the animation. Values between [0,1] will
277 * slow down the animation and values above one will speed up the animation. It is also possible to specify a negative multiplier
278 * to play the animation in reverse.
280 * @param[in] factor A value which will multiply the velocity.
282 void SetSpeedFactor( float factor );
285 * @brief Retrieve the speed factor of the animation
287 * @return speed factor
289 float GetSpeedFactor() const;
292 * @brief Set the playing range.
293 * Animation will play between the values specified. Both values ( range.x and range.y ) should be between 0-1,
294 * otherwise they will be ignored. If the range provided is not in proper order ( minimum,maximum ), it will be reordered.
296 * @param[in] range Two values between [0,1] to specify minimum and maximum progress. The
297 * animation will play between those values.
299 void SetPlayRange( const Vector2& range );
302 * @brief Get the playing range
304 * @return The play range defined for the animation.
306 Vector2 GetPlayRange() const;
309 * @brief Play the animation.
314 * @brief Play the animation from a given point.
315 * The progress must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
316 * otherwise, it will be ignored.
318 * @param[in] progress A value between [0,1], or between the play range if specified, form where the animation should start playing
320 void PlayFrom( float progress );
323 * @brief Pause the animation.
328 * @brief Stop the animation.
333 * @brief Clear the animation.
335 * This disconnects any objects that were being animated, effectively stopping the animation.
340 * @brief Connect to this signal to be notified when an Animation's animations have finished.
342 * @return A signal object to Connect() with.
344 AnimationSignalV2& FinishedSignal();
347 * @brief Animate a property value by a relative amount.
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] relativeValue The property value will change by this amount.
354 void AnimateBy(Property target, Property::Value relativeValue);
357 * @brief Animate a property value by a relative amount.
359 * The effect will start & end when the animation begins & ends.
360 * @param [in] target The target object/property to animate.
361 * @param [in] relativeValue The property value will change by this amount.
362 * @param [in] alpha The alpha function to apply.
364 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha);
367 * @brief Animate a property value by a relative amount.
369 * The default alpha function will be used.
370 * @param [in] target The target object/property to animate.
371 * @param [in] relativeValue The property value will increase/decrease by this amount.
372 * @param [in] period The effect will occur during this time period.
374 void AnimateBy(Property target, Property::Value relativeValue, TimePeriod period);
377 * @brief Animate a property value by a relative amount.
379 * @param [in] target The target object/property to animate.
380 * @param [in] relativeValue The property value will increase/decrease by this amount.
381 * @param [in] alpha The alpha function to apply.
382 * @param [in] period The effect will occur during this time period.
384 void AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period);
387 * @brief Animate a property to a destination value.
389 * The default alpha function will be used.
390 * The effect will start & end when the animation begins & ends.
391 * @param [in] target The target object/property to animate.
392 * @param [in] destinationValue The destination value.
394 void AnimateTo(Property target, Property::Value destinationValue);
397 * @brief Animate a property to a destination value.
399 * The effect will start & end when the animation begins & ends.
400 * @param [in] target The target object/property to animate.
401 * @param [in] destinationValue The destination value.
402 * @param [in] alpha The alpha function to apply.
404 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha);
407 * @brief Animate a property to a destination value.
409 * The default alpha function will be used.
410 * @param [in] target The target object/property to animate.
411 * @param [in] destinationValue The destination value.
412 * @param [in] period The effect will occur during this time period.
414 void AnimateTo(Property target, Property::Value destinationValue, TimePeriod period);
417 * @brief Animate a property to a destination value.
419 * @param [in] target The target object/property to animate.
420 * @param [in] destinationValue The destination value.
421 * @param [in] alpha The alpha function to apply.
422 * @param [in] period The effect will occur during this time period.
424 void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
427 * @brief Animate a property between keyframes.
429 * @param [in] target The target object/property to animate.
430 * @param [in] keyFrames The key frames
432 void AnimateBetween(Property target, KeyFrames& keyFrames);
435 * @brief Animate a property between keyframes.
437 * @param [in] target The target object/property to animate.
438 * @param [in] keyFrames The key frames
439 * @param [in] alpha The alpha function to apply.
441 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha);
444 * @brief Animate a property between keyframes.
446 * @param [in] target The target object/property to animate.
447 * @param [in] keyFrames The key frames
448 * @param [in] period The effect will occur during this time period.
450 void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period);
453 * @brief Animate a property between keyframes.
455 * @param [in] target The target object/property to animate.
456 * @param [in] keyFrames The key frames
457 * @param [in] alpha The alpha function to apply.
458 * @param [in] period The effect will occur during this time period.
460 void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
462 // Actor-specific convenience methods
465 * @brief Animate an actor's position and orientation through a predefined path. The actor will rotate to orient the supplied
466 * forward vector with the path's tangent. If forward is the zero vector then no rotation will happen.
468 * @param[in] actor The actor to animate
469 * @param[in] path The path. It defines position and orientation
470 * @param[in] forward The vector (in local space coordinate system) that will be oriented with the path's tangent direction
472 void Animate( Actor actor, Path path, const Vector3& forward );
475 * @brief Animate an actor's position and orientation through a predefined path. The actor will rotate to orient the supplied
476 * forward vector with the path's tangent. If forward is the zero vector then no rotation will happen.
478 * @param[in] actor The actor to animate
479 * @param[in] path The path. It defines position and orientation
480 * @param[in] forward The vector (in local space coordinate system) that will be oriented with the path's tangent direction
481 * @param [in] alpha The alpha function to apply.
483 void Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha );
486 * @brief Animate an actor's position and orientation through a predefined path. The actor will rotate to orient the supplied
487 * forward vector with the path's tangent. If forward is the zero vector then no rotation will happen.
489 * @param[in] actor The actor to animate
490 * @param[in] path The path. It defines position and orientation
491 * @param[in] forward The vector (in local space coordinate system) that will be oriented with the path's tangent direction
492 * @param [in] period The effect will occur during this time period.
494 void Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period );
497 * @brief Animate an actor's position and orientation through a predefined path. The actor will rotate to orient the supplied
498 * forward vector with the path's tangent. If forward is the zero vector then no rotation will happen.
500 * @param[in] actor The actor to animate
501 * @param[in] path The path. It defines position and orientation
502 * @param[in] forward The vector (in local space coordinate system) that will be oriented with the path's tangent direction
503 * @param [in] alpha The alpha function to apply.
504 * @param [in] period The effect will occur during this time period.
506 void Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period);
509 * @brief Move an actor relative to its position.
511 * The default alpha function will be used.
512 * The move will start & end when the animation begins & ends.
513 * @param [in] actor The actor to animate.
514 * @param [in] x axis displacement.
515 * @param [in] y axis displacement.
516 * @param [in] z axis displacement.
518 void MoveBy(Actor actor, float x, float y, float z);
521 * @brief Move an actor relative to its position.
523 * This overload allows the alpha function to be customized.
524 * The move will start & end when the animation begins & ends.
525 * @param [in] actor The actor to animate.
526 * @param [in] displacement relative to current position.
527 * @param [in] alpha The alpha function to apply.
529 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha);
532 * @brief Move an actor relative to its position.
534 * This overload allows the translation start & end time to be customized.
535 * @pre delaySeconds must be zero or greater.
536 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
537 * @param [in] actor The actor to animate.
538 * @param [in] displacement relative to current position.
539 * @param [in] alpha The alpha function to apply.
540 * @param [in] delaySeconds The initial delay from the start of the animation.
541 * @param [in] durationSeconds The duration of the translation.
543 void MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds);
546 * @brief Move an actor to a target position.
548 * The default alpha function will be used.
549 * The move will start & end when the animation begins & ends.
550 * @param [in] actor The actor to animate.
551 * @param [in] x axis position.
552 * @param [in] y axis position.
553 * @param [in] z axis position.
555 void MoveTo(Actor actor, float x, float y, float z);
558 * @brief Move an actor to a target position.
560 * This overload allows the alpha function to be customized.
561 * The move will start & end when the animation begins & ends.
562 * @param [in] actor The actor to animate.
563 * @param [in] position to move to
564 * @param [in] alpha The alpha function to apply.
566 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha);
569 * @brief Move an actor to a target position.
571 * This overload allows the translation start & end time to be customized.
572 * @pre delaySeconds must be zero or greater.
573 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
574 * @param [in] actor The actor to animate.
575 * @param [in] position to move to
576 * @param [in] alpha The alpha function to apply.
577 * @param [in] delaySeconds The initial delay from the start of the animation.
578 * @param [in] durationSeconds The duration of the translation.
580 void MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds);
583 * @brief Rotate an actor around an arbitrary axis.
585 * The default alpha function will be used.
586 * The rotation will start & end when the animation begins & ends.
587 * @param [in] actor The actor to animate.
588 * @param [in] angle The angle in degrees.
589 * @param [in] axis The axis to rotate around
591 void RotateBy(Actor actor, Degree angle, Vector3 axis);
594 * @brief Rotate an actor around an arbitrary axis.
596 * The default alpha function will be used.
597 * The rotation will start & end when the animation begins & ends.
598 * @param [in] actor The actor to animate.
599 * @param [in] angle The angle in radians.
600 * @param [in] axis The axis to rotate around
602 void RotateBy(Actor actor, Radian angle, Vector3 axis);
605 * @brief Rotate an actor around an arbitrary axis.
607 * This overload allows the alpha function to be customized.
608 * The rotation will start & end when the animation begins & ends.
609 * @param [in] actor The actor to animate.
610 * @param [in] angle The angle in radians.
611 * @param [in] axis The axis to rotate around.
612 * @param [in] alpha The alpha function to apply.
614 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
617 * @brief Rotate an actor around an arbitrary axis.
619 * This overload allows the alpha function to be customized.
620 * The rotation will start & end when the animation begins & ends.
621 * @param [in] actor The actor to animate.
622 * @param [in] angle The angle in radians.
623 * @param [in] axis The axis to rotate around.
624 * @param [in] alpha The alpha function to apply.
626 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
629 * @brief Rotate an actor around an arbitrary axis.
631 * This overload allows the rotation start & end time to be customized.
632 * @pre delaySeconds must be zero or greater.
633 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
634 * @param [in] actor The actor to animate.
635 * @param [in] angle The angle in degrees.
636 * @param [in] axis The axis to rotate around
637 * @param [in] alpha The alpha function to apply.
638 * @param [in] delaySeconds The initial delay from the start of the animation.
639 * @param [in] durationSeconds The duration of the rotation.
641 void RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
644 * @brief Rotate an actor around an arbitrary axis.
646 * This overload allows the rotation start & end time to be customized.
647 * @pre delaySeconds must be zero or greater.
648 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
649 * @param [in] actor The actor to animate.
650 * @param [in] angle The angle in radians.
651 * @param [in] axis The axis to rotate around
652 * @param [in] alpha The alpha function to apply.
653 * @param [in] delaySeconds The initial delay from the start of the animation.
654 * @param [in] durationSeconds The duration of the rotation.
656 void RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
659 * @brief Rotate an actor to a target orientation.
661 * The default alpha function will be used.
662 * The rotation will start & end when the animation begins & ends.
663 * @param [in] actor The actor to animate.
664 * @param [in] angle The target rotation angle in degrees.
665 * @param [in] axis The target axis of rotation.
667 void RotateTo(Actor actor, Degree angle, Vector3 axis);
670 * @brief Rotate an actor to a target orientation.
672 * The default alpha function will be used.
673 * The rotation will start & end when the animation begins & ends.
674 * @param [in] actor The actor to animate.
675 * @param [in] angle The target rotation angle in radians.
676 * @param [in] axis The target axis of rotation.
678 void RotateTo(Actor actor, Radian angle, Vector3 axis);
681 * @brief Rotate an actor to a target orientation.
683 * The default alpha function will be used.
684 * The rotation will start & end when the animation begins & ends.
685 * @param [in] actor The actor to animate.
686 * @param [in] orientation The target orientation.
688 void RotateTo(Actor actor, Quaternion orientation);
691 * @brief Rotate an actor to a target orientation.
693 * This overload allows the alpha function to be customized.
694 * The rotation will start & end when the animation begins & ends.
695 * @param [in] actor The actor to animate.
696 * @param [in] angle The target rotation angle in degrees.
697 * @param [in] axis The target axis of rotation.
698 * @param [in] alpha The alpha function to apply.
700 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha);
703 * @brief Rotate an actor to a target orientation.
705 * This overload allows the alpha function to be customized.
706 * The rotation will start & end when the animation begins & ends.
707 * @param [in] actor The actor to animate.
708 * @param [in] angle The target rotation angle in radians.
709 * @param [in] axis The target axis of rotation.
710 * @param [in] alpha The alpha function to apply.
712 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha);
715 * @brief Rotate an actor to a target orientation.
717 * This overload allows the alpha function to be customized.
718 * The rotation will start & end when the animation begins & ends.
719 * @param [in] actor The actor to animate.
720 * @param [in] orientation The target orientation.
721 * @param [in] alpha The alpha function to apply.
723 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha);
726 * @brief Rotate an actor to a target orientation.
728 * This overload allows the rotation start & end time to be customized.
729 * @pre delaySeconds must be zero or greater.
730 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
731 * @param [in] actor The actor to animate.
732 * @param [in] angle The target rotation angle in degrees.
733 * @param [in] axis The target axis of rotation.
734 * @param [in] alpha The alpha function to apply.
735 * @param [in] delaySeconds The initial delay from the start of the animation.
736 * @param [in] durationSeconds The duration of the rotation.
738 void RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
741 * @brief Rotate an actor to a target orientation.
743 * This overload allows the rotation start & end time to be customized.
744 * @pre delaySeconds must be zero or greater.
745 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
746 * @param [in] actor The actor to animate.
747 * @param [in] angle The target rotation angle in radians.
748 * @param [in] axis The target axis of rotation.
749 * @param [in] alpha The alpha function to apply.
750 * @param [in] delaySeconds The initial delay from the start of the animation.
751 * @param [in] durationSeconds The duration of the rotation.
753 void RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
756 * @brief Rotate an actor to a target orientation.
758 * This overload allows the rotation start & end time to be customized.
759 * @pre delaySeconds must be zero or greater.
760 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
761 * @param [in] actor The actor to animate.
762 * @param [in] orientation The target orientation.
763 * @param [in] alpha The alpha function to apply.
764 * @param [in] delaySeconds The initial delay from the start of the animation.
765 * @param [in] durationSeconds The duration of the rotation.
767 void RotateTo(Actor actor, Quaternion orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
770 * @brief Scale an actor.
772 * The default alpha function will be used.
773 * The scaling will start & end when the animation begins & ends.
774 * @param [in] actor The actor to animate.
775 * @param [in] x Scale factor in the X-direction.
776 * @param [in] y Scale factor in the Y-direction.
777 * @param [in] z Scale factor in the Z-direction.
779 void ScaleBy(Actor actor, float x, float y, float z);
782 * @brief Scale an actor.
784 * This overload allows the alpha function to be customized.
785 * The scaling will start & end when the animation begins & ends.
786 * @param [in] actor The actor to animate.
787 * @param [in] scale The scale factor.
788 * @param [in] alpha The alpha function to apply.
790 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha);
793 * @brief Scale an actor.
795 * This overload allows the scaling 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] scale The scale factor.
800 * @param [in] alpha The alpha function to apply.
801 * @param [in] delaySeconds The initial delay from the start of the animation.
802 * @param [in] durationSeconds The duration of the scaling.
804 void ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
807 * @brief Scale an actor to a target scale factor.
809 * The default alpha function will be used.
810 * The scaling will start & end when the animation begins & ends.
811 * @param [in] actor The actor to animate.
812 * @param [in] x Target scale-factor in the X-direction.
813 * @param [in] y Target scale-factor in the Y-direction.
814 * @param [in] z Target scale-factor in the Z-direction.
816 void ScaleTo(Actor actor, float x, float y, float z);
819 * @brief Scale an actor to a target scale factor.
821 * This overload allows the alpha function to be customized.
822 * The scaling will start & end when the animation begins & ends.
823 * @param [in] actor The actor to animate.
824 * @param [in] scale The target scale factor.
825 * @param [in] alpha The alpha function to apply.
827 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha);
830 * @brief Scale an actor to a target scale factor.
832 * This overload allows the scaling start & end time to be customized.
833 * @pre delaySeconds must be zero or greater.
834 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
835 * @param [in] actor The actor to animate.
836 * @param [in] scale The target scale factor.
837 * @param [in] alpha The alpha function to apply.
838 * @param [in] delaySeconds The initial delay from the start of the animation.
839 * @param [in] durationSeconds The duration of the scaling.
841 void ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
844 * @brief Show an actor during the animation.
846 * @param [in] actor The actor to animate.
847 * @param [in] delaySeconds The initial delay from the start of the animation.
849 void Show(Actor actor, float delaySeconds);
852 * @brief Hide an actor during the animation.
854 * @param [in] actor The actor to animate.
855 * @param [in] delaySeconds The initial delay from the start of the animation.
857 void Hide(Actor actor, float delaySeconds);
860 * @brief Animate the opacity of an actor.
862 * The default alpha function will be used.
863 * The effect will start & end when the animation begins & ends.
864 * @param [in] actor The actor to animate.
865 * @param [in] opacity The relative change in opacity.
867 void OpacityBy(Actor actor, float opacity);
870 * @brief Animate the opacity of an actor.
872 * This overload allows the alpha function to be customized.
873 * The effect will start & end when the animation begins & ends.
874 * @param [in] actor The actor to animate.
875 * @param [in] opacity The relative change in opacity.
876 * @param [in] alpha The alpha function to apply.
878 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha);
881 * @brief Animate the opacity of an actor.
883 * This overload allows the animation start & end time to be customized.
884 * @pre delaySeconds must be zero or greater.
885 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
886 * @param [in] actor The actor to animate.
887 * @param [in] opacity The relative change in opacity.
888 * @param [in] alpha The alpha function to apply.
889 * @param [in] delaySeconds The initial delay from the start of the animation.
890 * @param [in] durationSeconds The duration of the opacity animation.
892 void OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
895 * @brief Animate an actor to a target opacity.
897 * The default alpha function will be used.
898 * The effect will start & end when the animation begins & ends.
899 * @param [in] actor The actor to animate.
900 * @param [in] opacity The target opacity.
902 void OpacityTo(Actor actor, float opacity);
905 * @brief Animate an actor to a target opacity.
907 * This overload allows the alpha function to be customized.
908 * The effect will start & end when the animation begins & ends.
909 * @param [in] actor The actor to animate.
910 * @param [in] opacity The target opacity.
911 * @param [in] alpha The alpha function to apply.
913 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha);
916 * @brief Animate an actor to a target opacity.
918 * This overload allows the animation start & end time to be customized.
919 * @pre delaySeconds must be zero or greater.
920 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
921 * @param [in] actor The actor to animate.
922 * @param [in] opacity The target opacity.
923 * @param [in] alpha The alpha function to apply.
924 * @param [in] delaySeconds The initial delay from the start of the animation.
925 * @param [in] durationSeconds The duration of the opacity animation.
927 void OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
930 * @brief Animate the color of an actor.
932 * The default alpha function will be used.
933 * The effect will start & end when the animation begins & ends.
934 * @param [in] actor The actor to animate.
935 * @param [in] color The relative change in color.
937 void ColorBy(Actor actor, Vector4 color);
940 * @brief Animate the color of an actor.
942 * This overload allows the alpha function to be customized.
943 * The effect will start & end when the animation begins & ends.
944 * @param [in] actor The actor to animate.
945 * @param [in] color The relative change in color.
946 * @param [in] alpha The alpha function to apply.
948 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha);
951 * @brief Animate the color of an actor.
953 * This overload allows the animation start & end time to be customized.
954 * @pre delaySeconds must be zero or greater.
955 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
956 * @param [in] actor The actor to animate.
957 * @param [in] color The relative change in color.
958 * @param [in] alpha The alpha function to apply.
959 * @param [in] delaySeconds The initial delay from the start of the animation.
960 * @param [in] durationSeconds The duration of the color animation.
962 void ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
965 * @brief Animate an actor to a target color.
967 * The default alpha function will be used.
968 * The effect will start & end when the animation begins & ends.
969 * @param [in] actor The actor to animate.
970 * @param [in] color The target color.
972 void ColorTo(Actor actor, Vector4 color);
975 * @brief Animate an actor to a target color.
977 * This overload allows the alpha function to be customized.
978 * The effect will start & end when the animation begins & ends.
979 * @param [in] actor The actor to animate.
980 * @param [in] color The target color.
981 * @param [in] alpha The alpha function to apply.
983 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha);
986 * @brief Animate an actor to a target color.
988 * This overload allows the animation start & end time to be customized.
989 * @pre delaySeconds must be zero or greater.
990 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
991 * @param [in] actor The actor to animate.
992 * @param [in] color The target color.
993 * @param [in] alpha The alpha function to apply.
994 * @param [in] delaySeconds The initial delay from the start of the animation.
995 * @param [in] durationSeconds The duration of the color animation.
997 void ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1000 * @brief Resize an actor.
1002 * The default alpha function will be used.
1003 * The resizing will start & end when the animation begins & ends.
1004 * The depth defaults to the minimum of width & height.
1005 * @param [in] actor The actor to animate.
1006 * @param [in] width The target width.
1007 * @param [in] height The target height.
1009 void Resize(Actor actor, float width, float height);
1012 * @brief Resize an actor.
1014 * This overload allows the alpha function to be customized.
1015 * The resizing will start & end when the animation begins & ends.
1016 * The depth defaults to the minimum of width & height.
1017 * @param [in] actor The actor to animate.
1018 * @param [in] width The target width.
1019 * @param [in] height The target height.
1020 * @param [in] alpha The alpha function to apply.
1022 void Resize(Actor actor, float width, float height, AlphaFunction alpha);
1025 * @brief Resize an actor.
1027 * This overload allows the resizing start & end time to be customized.
1028 * The depth defaults to the minimum of width & height.
1029 * @pre delaySeconds must be zero or greater.
1030 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1031 * @param [in] actor The actor to animate.
1032 * @param [in] width The target width.
1033 * @param [in] height The target height.
1034 * @param [in] alpha The alpha function to apply.
1035 * @param [in] delaySeconds The initial delay from the start of the animation.
1036 * @param [in] durationSeconds The duration of the resizing.
1038 void Resize(Actor actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1041 * @brief Resize an actor.
1043 * The default alpha function will be used.
1044 * The resizing will start & end when the animation begins & ends.
1045 * @param [in] actor The actor to animate.
1046 * @param [in] size The target size.
1048 void Resize(Actor actor, Vector3 size);
1051 * @brief Resize an actor.
1053 * This overload allows the alpha function to be customized.
1054 * The resizing will start & end when the animation begins & ends.
1055 * @param [in] actor The actor to animate.
1056 * @param [in] size The target size.
1057 * @param [in] alpha The alpha function to apply.
1059 void Resize(Actor actor, Vector3 size, AlphaFunction alpha);
1062 * @brief Resize an actor.
1064 * This overload allows the resizing start & end time to be customized.
1065 * @pre delaySeconds must be zero or greater.
1066 * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
1067 * @param [in] actor The actor to animate.
1068 * @param [in] size The target size.
1069 * @param [in] alpha The alpha function to apply.
1070 * @param [in] delaySeconds The initial delay from the start of the animation.
1071 * @param [in] durationSeconds The duration of the resizing.
1073 void Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
1075 public: // Not intended for use by Application developers
1078 * @brief This constructor is used by Dali New() methods
1079 * @param [in] animation A pointer to a newly allocated Dali resource
1081 explicit DALI_INTERNAL Animation(Internal::Animation* animation);
1087 #endif // __DALI_ANIMATION_H__