X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fanimation%2Fanimation-impl.h;h=c605ec261202abe8234099f9fd26c4411054a9fc;hb=41e9a0ad46f71f270f69e75a08098f5105275cd3;hp=8eb52573ff469b2d8098c5c181b157e05d992042;hpb=ae502c16f86f3f841bb981e45d9a3f2efd7a158b;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 8eb5257..c605ec2 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) 2018 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,9 +23,10 @@ #include #include #include -#include +#include +#include #include -#include +#include namespace Dali { @@ -42,8 +43,9 @@ class UpdateManager; class Actor; class Animation; class AnimationPlaylist; +class AnimatorConnectorBase; class Object; -class ShaderEffect; +class Path; typedef IntrusivePtr AnimationPtr; typedef std::vector AnimationContainer; @@ -60,11 +62,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. @@ -78,6 +85,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; @@ -90,17 +107,17 @@ public: /** * @copydoc Dali::Animation::SetLoopCount() */ - void SetLoopCount(int count); + void SetLoopCount(int32_t count); /** * @copydoc Dali::Animation::GetLoopCount() */ - int GetLoopCount(); + int32_t GetLoopCount(); /** * @copydoc Dali::Animation::GetCurrentLoop() */ - int GetCurrentLoop(); + int32_t GetCurrentLoop(); /** * @copydoc Dali::Animation::IsLooping() @@ -154,6 +171,11 @@ public: void PlayFrom( float progress ); /** + * @copydoc Dali::Animation::PlayAfter() + */ + void PlayAfter( float delaySeconds ); + + /** * @copydoc Dali::Animation::Pause() */ void Pause(); @@ -186,11 +208,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. @@ -211,13 +243,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); @@ -258,17 +283,6 @@ public: void AnimateTo(Property& target, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period); /** - * Animate a property to a destination value. - * @param [in] targetObject The target object to animate. - * @param [in] targetPropertyIndex The index of the target property. - * @param [in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4 - * @param [in] destinationValue The destination value. - * @param [in] alpha The alpha function to apply. - * @param [in] period The effect will occur during this time period. - */ - void AnimateTo(Object& targetObject, Property::Index targetPropertyIndex, int componentIndex, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period); - - /** * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames) */ void AnimateBetween(Property target, const KeyFrames& keyFrames); @@ -340,36 +354,46 @@ public: */ void Hide(Actor& actor, float delaySeconds); - /* + /** * @copydoc Dali::Animation::SetCurrentProgress() */ void SetCurrentProgress(float progress); - /* + /** * @copydoc Dali::Animation::GetCurrentProgress() */ float GetCurrentProgress(); - /* + /** * @copydoc Dali::Animation::SetSpeedFactor() */ void SetSpeedFactor( float factor ); - /* + /** * @copydoc Dali::Animation::GetSpeedFactor() */ float GetSpeedFactor() const; - /* + /** * @copydoc Dali::Animation::SetPlayRange() */ void SetPlayRange( const Vector2& range ); - /* - * @copydoc Dali::Animation::GetPlayRange + /** + * @copydoc Dali::Animation::GetPlayRange() */ Vector2 GetPlayRange() const; + /** + * @copydoc Dali::Animation::SetLoopingMode() + */ + void SetLoopingMode( Dali::Animation::LoopingMode loopingMode ); + + /** + * @copydoc Dali::Animation::GetLoopingMode() + */ + Dali::Animation::LoopingMode GetLoopingMode() const; + public: // For connecting animators to animations /** @@ -449,31 +473,74 @@ private: Animation& operator=(const Animation& rhs); private: - EventThreadServices& mEventThreadServices; - AnimationPlaylist& mPlaylist; + + struct ConnectorTargetValues + { + ConnectorTargetValues() + : targetValue(), + timePeriod( 0.0f ), + connectorIndex( 0 ), + animatorType( TO ) + { + } + + Property::Value targetValue; + TimePeriod timePeriod; + std::size_t 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::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; float mSpeedFactor; - int mLoopCount; - int mCurrentLoop; - Vector2 mPlayRange; + int32_t mNotificationCount; ///< Keep track of how many Finished signals have been emitted. + int32_t mLoopCount; + int32_t mCurrentLoop; EndAction mEndAction; EndAction mDisconnectAction; AlphaFunction mDefaultAlpha; Dali::Animation::State mState; - + float mProgressReachedMarker; + float mDelaySeconds; + bool mAutoReverseEnabled; ///< Flag to identify that the looping mode is auto reverse. }; } // namespace Internal