X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fanimation%2Fanimation-impl.h;h=fa281011aa848b473af3f44bd832ec1c21ff40fb;hb=462cbee2270984cdca45488f3733d664dcf49187;hp=a2070912d7f986eebcc2d2f6df8035a6df70ff57;hpb=2fb9d2db60201372336d556965714ac84b694154;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 a207091..fa28101 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. @@ -25,6 +25,7 @@ #include #include #include +#include namespace Dali { @@ -41,8 +42,7 @@ class UpdateManager; class Actor; class Animation; class AnimationPlaylist; -class ProxyObject; -class ShaderEffect; +class Object; typedef IntrusivePtr AnimationPtr; typedef std::vector AnimationContainer; @@ -59,8 +59,8 @@ class Animation : public BaseObject { public: - typedef Dali::Animation::AnyFunction AnyFunction; typedef Dali::Animation::EndAction EndAction; + typedef Dali::Animation::Interpolation Interpolation; typedef void (*FinishedCallback)(Object* object); @@ -72,75 +72,62 @@ 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::Animation::GetDuration() */ - static AnimationPtr New(float durationSeconds, EndAction endAction, EndAction destroyAction, AlphaFunction alpha); + float GetDuration() const; /** - * Set the duration of an animation. - * @pre durationSeconds must be greater than zero. - * @param[in] seconds The duration in seconds. + * @copydoc Dali::Animation::SetLooping() */ - void SetDuration(float seconds); + void SetLooping(bool on); /** - * Retrieve the duration of an animation. - * @return The duration in seconds. + * @copydoc Dali::Animation::SetLoopCount() */ - float GetDuration() const; + void SetLoopCount(int count); /** - * Set whether the animation will loop. - * @param[in] looping True if the animation will loop. + * @copydoc Dali::Animation::GetLoopCount() */ - void SetLooping(bool looping); + int GetLoopCount(); /** - * Query whether the animation will loop. - * @return True if the animation will loop. + * @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 +135,7 @@ public: } /** - * Retrieve the default alpha function for an animation. - * @return The default alpha function. + * @copydoc Dali::Animation::GetDefaultAlphaFunction() */ AlphaFunction GetDefaultAlphaFunction() const { @@ -157,29 +143,32 @@ 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::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 +182,7 @@ public: /** * @copydoc Dali::Animation::FinishedSignal() */ - Dali::Animation::AnimationSignalV2& FinishedSignal(); + Dali::Animation::AnimationSignalType& FinishedSignal(); /** * Emit the Finished signal @@ -218,7 +207,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); + static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes); /** * This callback is intended for internal use only, to avoid the overhead of using a signal. @@ -276,517 +265,80 @@ 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. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation) */ - void Move(Actor& actor, AnimatorFunctionVector3 func, AlphaFunction alpha, float delaySeconds, float durationSeconds); + void AnimateBetween(Property target, const KeyFrames& keyFrames, Interpolation interpolation ); /** - * 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. + * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period) */ - 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. - */ - void RotateBy(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha); - - /** - * 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. - */ - 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. - */ - void Resize(Actor& actor, float width, float height, 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. - * @param [in] actor The actor to animate. - * @param [in] size The target size. - */ - void Resize(Actor& actor, const Vector3& size); - - /** - * 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. - */ - void Resize(Actor& actor, const Vector3& size, AlphaFunction alpha); - - /** - * 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. - */ - void Resize(Actor& actor, const Vector3& size, AlphaFunction alpha, float delaySeconds, float durationSeconds); - /* * @copydoc Dali::Animation::SetCurrentProgress() */ @@ -835,30 +387,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); /** @@ -897,28 +449,38 @@ private: private: - SceneGraph::UpdateManager& mUpdateManager; + struct ConnectorTargetValues + { + unsigned int connectorIndex; + Property::Value targetValue; + }; + + EventThreadServices& mEventThreadServices; AnimationPlaylist& mPlaylist; const SceneGraph::Animation* mAnimation; int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. - Dali::Animation::AnimationSignalV2 mFinishedSignal; + Dali::Animation::AnimationSignalType mFinishedSignal; FinishedCallback mFinishedCallback; Object* mFinishedCallbackObject; AnimatorConnectorContainer mConnectors; ///< Owned by the Animation + std::vector< ConnectorTargetValues > mConnectorTargetValues; //< Used to store animating property target value information + // Cached for public getters float mDurationSeconds; float mSpeedFactor; - bool mIsLooping; + int mLoopCount; + int mCurrentLoop; Vector2 mPlayRange; EndAction mEndAction; - EndAction mDestroyAction; + EndAction mDisconnectAction; AlphaFunction mDefaultAlpha; + Dali::Animation::State mState; };