X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fanimation%2Fanimation-impl.h;h=bf1e628a3d1edc04d83c7e730390ae4b093ae10e;hb=77de4c4ae763aeb42c5bf02be9191ab0694b48a1;hp=775637cc824e1d52e293a49dbd7c316934def93e;hpb=48cd32451070624634a66f17ecf01509090429dd;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/animation/animation-impl.h b/dali/internal/event/animation/animation-impl.h index 775637c..bf1e628 100644 --- a/dali/internal/event/animation/animation-impl.h +++ b/dali/internal/event/animation/animation-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_ANIMATION_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,9 @@ #include #include #include -#include +#include #include +#include namespace Dali { @@ -41,8 +42,9 @@ class UpdateManager; class Actor; class Animation; class AnimationPlaylist; -class ProxyObject; -class ShaderEffect; +class AnimatorConnectorBase; +class Object; +class Path; typedef IntrusivePtr AnimationPtr; typedef std::vector AnimationContainer; @@ -59,10 +61,15 @@ class Animation : public BaseObject { public: - typedef Dali::Animation::AnyFunction AnyFunction; - typedef Dali::Animation::EndAction EndAction; + enum Type + { + TO, ///< Animating TO the given value + BY, ///< Animating BY the given value + BETWEEN ///< Animating BETWEEN key-frames + }; - typedef void (*FinishedCallback)(Object* object); + typedef Dali::Animation::EndAction EndAction; + typedef Dali::Animation::Interpolation Interpolation; /** * Create a new Animation object. @@ -72,75 +79,72 @@ public: static AnimationPtr New(float durationSeconds); /** - * Create a new Animation object. - * @param[in] durationSeconds The duration of the animation. - * @param[in] endAction The action to perform when the animation ends. - * @param[in] destroyAction The action to perform when the animation ends. - * @return A smart-pointer to the newly allocated Animation. + * @copydoc Dali::Animation::SetDuration() */ - static AnimationPtr New(float durationSeconds, EndAction endAction, EndAction destroyAction); + void SetDuration(float seconds); /** - * Create a new Animation object. - * @param[in] durationSeconds The duration of the animation. - * @param[in] endAction The action to perform when the animation ends. - * @param[in] destroyAction The action to perform when the animation ends. - * @param[in] alpha The default alpha function to apply to animators. - * @return A smart-pointer to the newly allocated Animation. + * @copydoc Dali::DevelAnimation::SetProgressNotification() */ - static AnimationPtr New(float durationSeconds, EndAction endAction, EndAction destroyAction, AlphaFunction alpha); + void SetProgressNotification( float progress ); /** - * Set the duration of an animation. - * @pre durationSeconds must be greater than zero. - * @param[in] seconds The duration in seconds. + * @copydoc Dali::DevelAnimation::GetProgressNotification() */ - void SetDuration(float seconds); + float GetProgressNotification(); /** - * Retrieve the duration of an animation. - * @return The duration in seconds. + * @copydoc Dali::Animation::GetDuration() */ float GetDuration() const; /** - * Set whether the animation will loop. - * @param[in] looping True if the animation will loop. + * @copydoc Dali::Animation::SetLooping() */ - void SetLooping(bool looping); + void SetLooping(bool on); /** - * Query whether the animation will loop. - * @return True if the animation will loop. + * @copydoc Dali::Animation::SetLoopCount() + */ + void SetLoopCount(int count); + + /** + * @copydoc Dali::Animation::GetLoopCount() + */ + int GetLoopCount(); + + /** + * @copydoc Dali::Animation::GetCurrentLoop() + */ + int GetCurrentLoop(); + + /** + * @copydoc Dali::Animation::IsLooping() */ bool IsLooping() const; /** - * Set the end action of the animation. - * @param[in] action The end action. + * @copydoc Dali::Animation::SetEndAction() */ void SetEndAction(EndAction action); /** - * Returns the end action of the animation. + * @copydoc Dali::Animation::GetEndAction() */ EndAction GetEndAction() const; /** - * Set the destroy action of the animation. - * @param[in] action The destroy action. + * @copydoc Dali::Animation::SetDisconnectAction() */ - void SetDestroyAction(EndAction action); + void SetDisconnectAction(EndAction action); /** - * Returns the destroy action of the animation. + * @copydoc Dali::Animation::GetDisconnectAction() */ - EndAction GetDestroyAction() const; + EndAction GetDisconnectAction() const; /** - * Set the default alpha function for an animation. - * This is applied to individual property animations, if no further alpha functions are supplied. - * @param[in] alpha The default alpha function. + * @copydoc Dali::Animation::SetDefaultAlphaFunction() */ void SetDefaultAlphaFunction(AlphaFunction alpha) { @@ -148,8 +152,7 @@ public: } /** - * Retrieve the default alpha function for an animation. - * @return The default alpha function. + * @copydoc Dali::Animation::GetDefaultAlphaFunction() */ AlphaFunction GetDefaultAlphaFunction() const { @@ -157,29 +160,37 @@ public: } /** - * (Re)start the animation. + * @copydoc Dali::Animation::Play() */ void Play(); /** - * (Re)start the animation from a given point. - * @param[in] progress The progress between [0,1] from where the animation should start + * @copydoc Dali::Animation::PlayFrom() */ void PlayFrom( float progress ); /** - * Pause the animation. + * @copydoc Dali::Animation::PlayAfter() + */ + void PlayAfter( float delaySeconds ); + + /** + * @copydoc Dali::Animation::Pause() */ void Pause(); /** - * Stop the animation. + * @copydoc Dali::Animation::GetState() + */ + Dali::Animation::State GetState() const; + + /** + * @copydoc Dali::Animation::Stop() */ void Stop(); /** - * Clear the animation. - * This disconnects any objects that were being animated, effectively stopping the animation. + * @copydoc Dali::Animation::Clear() */ void Clear(); @@ -193,7 +204,12 @@ public: /** * @copydoc Dali::Animation::FinishedSignal() */ - Dali::Animation::AnimationSignalV2& FinishedSignal(); + Dali::Animation::AnimationSignalType& FinishedSignal(); + + /** + * @copydoc Dali::DevelAnimation::ProgressHasBeenReachedSignal() + */ + Dali::Animation::AnimationSignalType& ProgressReachedSignal(); /** * Emit the Finished signal @@ -201,6 +217,11 @@ public: void EmitSignalFinish(); /** + * Emit the ProgressReached signal + */ + void EmitSignalProgressReached(); + + /** * Connects a callback function with the object's signals. * @param[in] object The object providing the signal. * @param[in] tracker Used to disconnect the signal. @@ -218,14 +239,7 @@ public: * @param[in] attributes The attributes with which to perfrom this action. * @return true if action was done */ - static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector& attributes); - - /** - * This callback is intended for internal use only, to avoid the overhead of using a signal. - * @param[in] callback The callback function to connect. - * @param[in] object The internal object requesting the callback, or NULL. - */ - void SetFinishedCallback( FinishedCallback callback, Object* object ); + static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes); /** * @copydoc Dali::Animation::AnimateBy(Property target, Property::Value relativeValue) @@ -276,526 +290,109 @@ public: * @param [in] alpha The alpha function to apply. * @param [in] period The effect will occur during this time period. */ - void AnimateTo(ProxyObject& targetObject, Property::Index targetPropertyIndex, int componentIndex, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period); - + void AnimateTo(Object& targetObject, Property::Index targetPropertyIndex, int componentIndex, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period); /** - * Animate a property between the keyframe time / value pairs. - * It uses the current duration of the animation to run the key - * frame animator. Note, If the animation duration is subsequently - * changed, this does not change to match. - * - * @param[in] target The target object + property to animate - * @param[in] keyFrames The set of time / value pairs between which to animate. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames) */ void AnimateBetween(Property target, const KeyFrames& keyFrames); /** - * Animate a property between the keyframe time / value pairs. - * @param[in] target The target object + property to animate - * @param[in] keyFrames The set of time / value pairs between which to animate. - * @param[in] period The effect will occur duing this time period. - */ - void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period); - - /** - * Animate a property between the keyframe time / value pairs. - * @param[in] target The target object + property to animate - * @param[in] keyFrames The set of time / value pairs between which to animate. - * @param[in] alpha The alpha function to apply to the overall progress. - */ - void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha); - - /** - * Animate a property between the keyframe time / value pairs. - * @param[in] target The target object + property to animate - * @param[in] keyFrames The set of time / value pairs between which to animate. - * @param[in] alpha The alpha function to apply to the overall progress. - * @param[in] period The effect will occur duing this time period. - */ - void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period); - - /** - * @copydoc Dali::Animation::Animate( Property target, Property::Type targetType, AnyFunction func ) - */ - void Animate( Property& target, Property::Type targetType, AnyFunction& func ); - - /** - * @copydoc Dali::Animation::Animate(Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha ) - */ - void Animate( Property& target, Property::Type targetType, AnyFunction& func, AlphaFunction& alpha ); - - /** - * @copydoc Dali::Animation::Animate(Property target, Property::Type targetType, AnyFunction func, TimePeriod period) - */ - void Animate( Property& target, Property::Type targetType, AnyFunction& func, TimePeriod period ); - - /** - * @copydoc Dali::Animation::Animate(Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha, TimePeriod period) - */ - void Animate( Property& target, Property::Type targetType, AnyFunction& func, AlphaFunction& alpha, TimePeriod period ); - - // Action-specific convenience functions - - /** - * Translate an actor. - * The default alpha function will be used. - * The translation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] x Translation in the X-direction. - * @param [in] y Translation in the Y-direction. - * @param [in] z Translation in the Z-direction. - */ - void MoveBy(Actor& actor, float x, float y, float z); - - /** - * Translate an actor. This overload allows the alpha function to be customized. - * The translation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] translation The translation. - * @param [in] alpha The alpha function to apply. - */ - void MoveBy(Actor& actor, const Vector3& translation, AlphaFunction alpha); - - /** - * Translate an actor. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] translation The translation. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. - */ - void MoveBy(Actor& actor, const Vector3& translation, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Translate an actor to a target position. - * The default alpha function will be used. - * The translation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] x Translation in the X-direction. - * @param [in] y Translation in the Y-direction. - * @param [in] z Translation in the Z-direction. - */ - void MoveTo(Actor& actor, float x, float y, float z); - - /** - * Translate an actor to a target position. This overload allows the alpha function to be customized. - * The translation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] translation The translation. - * @param [in] alpha The alpha function to apply. - */ - void MoveTo(Actor& actor, const Vector3& translation, AlphaFunction alpha); - - /** - * Translate an actor to a target position. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] translation The translation. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. - */ - void MoveTo(Actor& actor, const Vector3& translation, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Translate an actor using a custom function. - * The animatorFunc will be called from the rendering thread; it should return quickly, to avoid performance degredation. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values. - * @param [in] actor The actor to animate. - * @param [in] func The function to call during the animation. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. - */ - void Move(Actor& actor, AnimatorFunctionVector3 func, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Rotate an actor around an arbitrary axis. - * The default alpha function will be used. - * The rotation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] angle The angle in radians. - * @param [in] axis The axis of rotation. - */ - void RotateBy(Actor& actor, Radian angle, const Vector3& axis); - - /** - * Rotate an actor around an arbitrary axis. This overload allows the alpha function to be customized. - * The rotation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] angle The angle in radians. - * @param [in] axis The axis of rotation. - * @param [in] alpha The alpha function to apply. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation) */ - void RotateBy(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha); + void AnimateBetween(Property target, const KeyFrames& keyFrames, Interpolation interpolation ); /** - * Rotate an actor around an arbitrary axis. This overload allows the rotation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values. - * @param [in] actor The actor to animate. - * @param [in] angle The angle in radians. - * @param [in] axis The axis of rotation. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the rotation. - */ - void RotateBy(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Rotate an actor to a target orientation. - * The default alpha function will be used. - * The rotation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] angle The target rotation angle in radians. - * @param [in] axis The target axis of rotation. - */ - void RotateTo(Actor& actor, Radian angle, const Vector3& axis); - - /** - * Rotate an actor to a target orientation. - * The default alpha function will be used. - * The rotation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] orientation The target orientation. - */ - void RotateTo(Actor& actor, const Quaternion& orientation); - - /** - * Rotate an actor to a target orientation. This overload allows the alpha function to be customized. - * The rotation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] angle The target rotation angle in radians. - * @param [in] axis The target axis of rotation. - * @param [in] alpha The alpha function to apply. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period) */ - void RotateTo(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha); + void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period); /** - * Rotate an actor to a target orientation. This overload allows the alpha function to be customized. - * The rotation will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] orientation The target orientation. - * @param [in] alpha The alpha function to apply. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation) */ - void RotateTo(Actor& actor, const Quaternion& orientation, AlphaFunction alpha); + void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation); /** - * Rotate an actor to a target orientation. This overload allows the rotation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] orientation The target orientation. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the rotation. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha) */ - void RotateTo(Actor& actor, const Quaternion& orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds); + void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha); /** - * Rotate an actor to a target orientation. This overload allows the rotation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] angle The target rotation angle in radians. - * @param [in] axis The target axis of rotation. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the rotation. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation) */ - void RotateTo(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha, float delaySeconds, float durationSeconds); + void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation); /** - * Rotate an actor using a custom function. - * The animatorFunc will be called from the rendering thread; it should return quickly, to avoid performance degredation. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values. - * @param [in] actor The actor to animate. - * @param [in] func The function to call during the animation. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period) */ - void Rotate(Actor& actor, AnimatorFunctionQuaternion func, AlphaFunction alpha, float delaySeconds, float durationSeconds); + void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period); /** - * Scale an actor. - * The default alpha function will be used. - * The scaling will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] x Scale factor in the X-direction. - * @param [in] y Scale factor in the Y-direction. - * @param [in] z Scale factor in the Z-direction. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation ) */ - void ScaleBy(Actor& actor, float x, float y, float z); + void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation ); - /** - * Scale an actor. This overload allows the alpha function to be customized. - * The scaling will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] scale The scale factor. - * @param [in] alpha The alpha function to apply. - */ - void ScaleBy(Actor& actor, const Vector3& scale, AlphaFunction alpha); + // Actor-specific convenience functions /** - * Scale an actor. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] scale The scale factor. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. + * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward ) */ - void ScaleBy(Actor& actor, const Vector3& scale, AlphaFunction alpha, float delaySeconds, float durationSeconds); + void Animate( Actor& actor, const Path& path, const Vector3& forward ); /** - * Scale an actor to a target scale factor. - * The default alpha function will be used. - * The scaling will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] x Target scale-factor in the X-direction. - * @param [in] y Target scale-factor in the Y-direction. - * @param [in] z Target scale-factor in the Z-direction. + * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha ) */ - void ScaleTo(Actor& actor, float x, float y, float z); + void Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha ); /** - * Scale an actor to a target scale factor. This overload allows the alpha function to be customized. - * The scaling will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] scale The target scale factor. - * @param [in] alpha The alpha function to apply. + * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period ) */ - void ScaleTo(Actor& actor, const Vector3& scale, AlphaFunction alpha); + void Animate( Actor& actor, const Path& path, const Vector3& forward, TimePeriod period ); /** - * Scale an actor to a target scale factor. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] scale The target scale factor. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. + * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period) */ - void ScaleTo(Actor& actor, const Vector3& scale, AlphaFunction alpha, float delaySeconds, float durationSeconds); + void Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha, TimePeriod period); /** - * Show an actor during the animation. - * @param [in] actor The actor to animate. - * @param [in] delaySeconds The initial delay from the start of the animation. + * @copydoc Dali::Animation::Show() */ void Show(Actor& actor, float delaySeconds); /** - * Hide an actor during the animation. - * @param [in] actor The actor to animate. - * @param [in] delaySeconds The initial delay from the start of the animation. + * @copydoc Dali::Animation::Hide() */ void Hide(Actor& actor, float delaySeconds); - /** - * Animate the opacity of an actor. - * The default alpha function will be used. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] opacity The relative change in opacity. - */ - void OpacityBy(Actor& actor, float opacity); - - /** - * Animate the opacity of an actor. This overload allows the alpha function to be customized. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] opacity The relative change in opacity. - * @param [in] alpha The alpha function to apply. - */ - void OpacityBy(Actor& actor, float opacity, AlphaFunction alpha); - - /** - * Animate the opacity of an actor. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] opacity The relative change in opacity. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. - */ - void OpacityBy(Actor& actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Animate an actor to a target opacity. - * The default alpha function will be used. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] opacity The target opacity. - */ - void OpacityTo(Actor& actor, float opacity); - - /** - * Animate an actor to a target opacity. This overload allows the alpha function to be customized. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] opacity The target opacity. - * @param [in] alpha The alpha function to apply. - */ - void OpacityTo(Actor& actor, float opacity, AlphaFunction alpha); - - /** - * Animate an actor to a target opacity. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] opacity The target opacity. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. - */ - void OpacityTo(Actor& actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Animate the color of an actor. - * The default alpha function will be used. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] color The relative change in color. - */ - void ColorBy(Actor& actor, const Vector4& color); - - /** - * Animate the color of an actor. This overload allows the alpha function to be customized. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] color The relative change in color. - * @param [in] alpha The alpha function to apply. - */ - void ColorBy(Actor& actor, const Vector4& color, AlphaFunction alpha); - - /** - * Animate the color of an actor. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values. - * @param [in] actor The actor to animate. - * @param [in] color The relative change in color. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. - */ - void ColorBy(Actor& actor, const Vector4& color, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Animate an actor to a target color. - * The default alpha function will be used. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] color The target color. - */ - void ColorTo(Actor& actor, const Vector4& color); - - /** - * Animate an actor to a target color. This overload allows the alpha function to be customized. - * The effect will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] color The target color. - * @param [in] alpha The alpha function to apply. - */ - void ColorTo(Actor& actor, const Vector4& color, AlphaFunction alpha); - - /** - * Animate an actor to a target color. This overload allows the translation start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values. - * @param [in] actor The actor to animate. - * @param [in] color The target color. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. - */ - void ColorTo(Actor& actor, const Vector4& color, AlphaFunction alpha, float delaySeconds, float durationSeconds); - - /** - * Resize an actor. - * The default alpha function will be used. - * The resizing will start & end when the animation begins & ends. - * The depth defaults to the minimum of width & height. - * @param [in] actor The actor to animate. - * @param [in] width The target width. - * @param [in] height The target height. - */ - void Resize(Actor& actor, float width, float height); - - /** - * Resize an actor. This overload allows the alpha function to be customized. - * The resizing will start & end when the animation begins & ends. - * The depth defaults to the minimum of width & height. - * @param [in] actor The actor to animate. - * @param [in] width The target width. - * @param [in] height The target height. - * @param [in] alpha The alpha function to apply. - */ - void Resize(Actor& actor, float width, float height, AlphaFunction alpha); - - /** - * Resize an actor. This overload allows the resizing start & end time to be customized. - * The depth defaults to the minimum of width & height. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] width The target width. - * @param [in] height The target height. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. + /* + * @copydoc Dali::Animation::SetCurrentProgress() */ - void Resize(Actor& actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds); + void SetCurrentProgress(float progress); - /** - * Resize an actor. - * The default alpha function will be used. - * The resizing will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] size The target size. + /* + * @copydoc Dali::Animation::GetCurrentProgress() */ - void Resize(Actor& actor, const Vector3& size); + float GetCurrentProgress(); - /** - * Resize an actor. This overload allows the alpha function to be customized. - * The resizing will start & end when the animation begins & ends. - * @param [in] actor The actor to animate. - * @param [in] size The target size. - * @param [in] alpha The alpha function to apply. + /* + * @copydoc Dali::Animation::SetSpeedFactor() */ - void Resize(Actor& actor, const Vector3& size, AlphaFunction alpha); + void SetSpeedFactor( float factor ); - /** - * Resize an actor. This overload allows the resizing start & end time to be customized. - * @pre delaySeconds must be zero or greater. - * @pre durationSeconds must be greater than zero. - * @param [in] actor The actor to animate. - * @param [in] size The target size. - * @param [in] alpha The alpha function to apply. - * @param [in] delaySeconds The initial delay from the start of the animation. - * @param [in] durationSeconds The duration of the translation. + /* + * @copydoc Dali::Animation::GetSpeedFactor() */ - void Resize(Actor& actor, const Vector3& size, AlphaFunction alpha, float delaySeconds, float durationSeconds); + float GetSpeedFactor() const; /* - * @copydoc Dali::Animation::GetCurrentProgress() + * @copydoc Dali::Animation::SetPlayRange() */ - float GetCurrentProgress(); + void SetPlayRange( const Vector2& range ); /* - * @copydoc Dali::Animation::SetCurrentProgress() + * @copydoc Dali::Animation::GetPlayRange */ - void SetCurrentProgress(float progress); + Vector2 GetPlayRange() const; public: // For connecting animators to animations @@ -815,30 +412,30 @@ public: // For connecting animators to animations } /** - * Retrieve the UpdateManager associated with this animation. - * @return The UpdateManager. + * Retrieve the event thread services object + * @return The interface for sending messages to the scene graph */ - SceneGraph::UpdateManager& GetUpdateManager() + EventThreadServices& GetEventThreadServices() { - return mUpdateManager; + return mEventThreadServices; } protected: /** * Construct a new Animation. - * @param[in] updateManager The UpdateManager associated with this animation. + * @param[in] eventThreadServices The interface for sending messages to the scene graph * @param[in] playlist The list of currently playing animations. * @param[in] durationSeconds The duration of the animation in seconds. * @param[in] endAction The action to perform when the animation ends. - * @param[in] destroyAction The action to perform when the animation is destroyed. + * @param[in] disconnectAction The action to perform when the property owner of an animator is disconnected. * @param[in] defaultAlpha The default alpha function to apply to animators. */ - Animation( SceneGraph::UpdateManager& updateManager, + Animation( EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, - EndAction destroyAction, + EndAction disconnectAction, AlphaFunction defaultAlpha); /** @@ -877,27 +474,72 @@ private: private: - SceneGraph::UpdateManager& mUpdateManager; - AnimationPlaylist& mPlaylist; + struct ConnectorTargetValues + { + ConnectorTargetValues() + : targetValue(), + timePeriod( 0.0f ), + connectorIndex( 0 ), + animatorType( TO ) + { + } + + Property::Value targetValue; + TimePeriod timePeriod; + unsigned int connectorIndex; + Animation::Type animatorType; + }; + +private: + + /** + * Compares the end times of the animators returning true if lhs end time is less than rhs end time. + * @param[in] lhs The first comparator + * @param[in] rhs The second comparator + * @return True if end time of lhs is less, false otherwise. + */ + static bool CompareConnectorEndTimes( const ConnectorTargetValues& lhs, const ConnectorTargetValues& rhs ); + + /** + * Notifies all the objects whose properties are being animated. + */ + void NotifyObjects(); + + /** + * Sends message to SceneGraph with final progress value + */ + void SendFinalProgressNotificationMessage(); + +private: const SceneGraph::Animation* mAnimation; - int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. + EventThreadServices& mEventThreadServices; + AnimationPlaylist& mPlaylist; - Dali::Animation::AnimationSignalV2 mFinishedSignal; + Dali::Animation::AnimationSignalType mFinishedSignal; - FinishedCallback mFinishedCallback; - Object* mFinishedCallbackObject; + Dali::Animation::AnimationSignalType mProgressReachedSignal; + typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer; AnimatorConnectorContainer mConnectors; ///< Owned by the Animation - // Cached for public getters + typedef std::vector< ConnectorTargetValues > ConnectorTargetValuesContainer; + ConnectorTargetValuesContainer mConnectorTargetValues; //< Used to store animating property target value information + + Vector2 mPlayRange; + float mDurationSeconds; - bool mIsLooping; + float mSpeedFactor; + int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. + int mLoopCount; + int mCurrentLoop; EndAction mEndAction; - EndAction mDestroyAction; + EndAction mDisconnectAction; AlphaFunction mDefaultAlpha; - + Dali::Animation::State mState; + float mProgressReachedMarker; + float mDelaySeconds; }; } // namespace Internal