X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fanimation%2Fscene-graph-animation.h;h=3e27055f4ada3db8e6a9daeda3264536cc954150;hb=77de4c4ae763aeb42c5bf02be9191ab0694b48a1;hp=2b01ff850ba3ed920d907eafea013ec50dde919e;hpb=e2ee93d144c63abb914c086281d09c40b213919f;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/animation/scene-graph-animation.h b/dali/internal/update/animation/scene-graph-animation.h index 2b01ff8..3e27055 100644 --- a/dali/internal/update/animation/scene-graph-animation.h +++ b/dali/internal/update/animation/scene-graph-animation.h @@ -92,6 +92,12 @@ public: void SetDuration(float durationSeconds); /** + * Set the progress marker to trigger notification + * @param[in] progress percent of progress to trigger notification, 0.0f < progress <= 1.0f + */ + void SetProgressNotification( float progress ); + + /** * Retrieve the duration of the animation. * @return The duration in seconds. */ @@ -198,13 +204,19 @@ public: */ void Play(); - /* + /** * Play the animation from a given point * @param[in] progress A value between [0,1] form where the animation should start playing */ void PlayFrom( float progress ); /** + * @brief Play the animation after a given delay time. + * @param[in] delaySeconds The delay time + */ + void PlayAfter( float delaySeconds ); + + /** * Pause the animation. */ void Pause(); @@ -274,8 +286,9 @@ public: * @param[in] elapsedSeconds The time elapsed since the previous frame. * @param[out] looped True if the animation looped * @param[out] finished True if the animation has finished. + * @param[out] progressReached True if progress marker reached */ - void Update(BufferIndex bufferIndex, float elapsedSeconds, bool& looped, bool& finished ); + void Update(BufferIndex bufferIndex, float elapsedSeconds, bool& looped, bool& finished, bool& progressReached ); protected: @@ -318,20 +331,27 @@ private: protected: + AnimatorContainer mAnimators; + + Vector2 mPlayRange; + float mDurationSeconds; + float mDelaySeconds; + float mElapsedSeconds; float mSpeedFactor; - EndAction mEndAction; - EndAction mDisconnectAction; + float mProgressMarker; // Progress marker to trigger a notification - State mState; - float mElapsedSeconds; int mPlayedCount; // Incremented at end of animation or completion of all loops // Never incremented when looping forever. Event thread tracks to signal end. int mLoopCount; // N loop setting int mCurrentLoop; // Current loop number - Vector2 mPlayRange; - AnimatorContainer mAnimators; + EndAction mEndAction; + EndAction mDisconnectAction; + + State mState; + + bool mProgressReachedSignalRequired; // Flag to indicate the progress marker was hit }; }; //namespace SceneGraph @@ -355,6 +375,18 @@ inline void SetDurationMessage( EventThreadServices& eventThreadServices, const new (slot) LocalType( &animation, &Animation::SetDuration, durationSeconds ); } +inline void SetProgressNotificationMessage( EventThreadServices& eventThreadServices, const Animation& animation, float progress ) +{ + typedef MessageValue1< Animation, float > LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &animation, &Animation::SetProgressNotification, progress ); +} + + inline void SetLoopingMessage( EventThreadServices& eventThreadServices, const Animation& animation, int loopCount ) { typedef MessageValue1< Animation, int > LocalType; @@ -466,6 +498,16 @@ inline void AddAnimatorMessage( EventThreadServices& eventThreadServices, const new (slot) LocalType( &animation, &Animation::AddAnimator, parameter ); } +inline void PlayAfterMessage( EventThreadServices& eventThreadServices, const Animation& animation, float delaySeconds ) +{ + typedef MessageValue1< Animation, float > LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &animation, &Animation::PlayAfter, delaySeconds ); +} } // namespace SceneGraph