X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fanimation%2Fanimation-impl.h;h=bf1e628a3d1edc04d83c7e730390ae4b093ae10e;hb=77de4c4ae763aeb42c5bf02be9191ab0694b48a1;hp=7239ed4723ccbe11e0008c0602935da02455d13a;hpb=51322ee06c00e4658b4875c49068e06058870dad;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 7239ed4..bf1e628 100644 --- a/dali/internal/event/animation/animation-impl.h +++ b/dali/internal/event/animation/animation-impl.h @@ -23,9 +23,9 @@ #include #include #include -#include +#include #include -#include +#include namespace Dali { @@ -42,7 +42,9 @@ class UpdateManager; class Actor; class Animation; class AnimationPlaylist; +class AnimatorConnectorBase; class Object; +class Path; typedef IntrusivePtr AnimationPtr; typedef std::vector AnimationContainer; @@ -59,11 +61,16 @@ class Animation : public BaseObject { public: + enum Type + { + TO, ///< Animating TO the given value + BY, ///< Animating BY the given value + BETWEEN ///< Animating BETWEEN key-frames + }; + typedef Dali::Animation::EndAction EndAction; typedef Dali::Animation::Interpolation Interpolation; - typedef void (*FinishedCallback)(Object* object); - /** * Create a new Animation object. * @param[in] durationSeconds The duration of the animation. @@ -77,6 +84,16 @@ public: void SetDuration(float seconds); /** + * @copydoc Dali::DevelAnimation::SetProgressNotification() + */ + void SetProgressNotification( float progress ); + + /** + * @copydoc Dali::DevelAnimation::GetProgressNotification() + */ + float GetProgressNotification(); + + /** * @copydoc Dali::Animation::GetDuration() */ float GetDuration() const; @@ -153,6 +170,11 @@ public: void PlayFrom( float progress ); /** + * @copydoc Dali::Animation::PlayAfter() + */ + void PlayAfter( float delaySeconds ); + + /** * @copydoc Dali::Animation::Pause() */ void Pause(); @@ -185,11 +207,21 @@ public: Dali::Animation::AnimationSignalType& FinishedSignal(); /** + * @copydoc Dali::DevelAnimation::ProgressHasBeenReachedSignal() + */ + Dali::Animation::AnimationSignalType& ProgressReachedSignal(); + + /** * Emit the Finished signal */ 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. @@ -210,13 +242,6 @@ public: 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. - * @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 ); - - /** * @copydoc Dali::Animation::AnimateBy(Property target, Property::Value relativeValue) */ void AnimateBy(Property& target, Property::Value& relativeValue); @@ -451,37 +476,70 @@ private: struct ConnectorTargetValues { - unsigned int connectorIndex; + ConnectorTargetValues() + : targetValue(), + timePeriod( 0.0f ), + connectorIndex( 0 ), + animatorType( TO ) + { + } + Property::Value targetValue; + TimePeriod timePeriod; + unsigned int connectorIndex; + Animation::Type animatorType; }; - EventThreadServices& mEventThreadServices; - AnimationPlaylist& mPlaylist; +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::AnimationSignalType mFinishedSignal; - FinishedCallback mFinishedCallback; - Object* mFinishedCallbackObject; + Dali::Animation::AnimationSignalType mProgressReachedSignal; + typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer; AnimatorConnectorContainer mConnectors; ///< Owned by the Animation - std::vector< ConnectorTargetValues > mConnectorActorTargetValues; //< Store Actor target values and matchinf connector index that need to set value on Animation::Play + typedef std::vector< ConnectorTargetValues > ConnectorTargetValuesContainer; + ConnectorTargetValuesContainer mConnectorTargetValues; //< Used to store animating property target value information + + Vector2 mPlayRange; - // Cached for public getters float mDurationSeconds; float mSpeedFactor; + int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. int mLoopCount; int mCurrentLoop; - Vector2 mPlayRange; EndAction mEndAction; EndAction mDisconnectAction; AlphaFunction mDefaultAlpha; Dali::Animation::State mState; - + float mProgressReachedMarker; + float mDelaySeconds; }; } // namespace Internal