}
Animation::Animation( EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, EndAction disconnectAction, AlphaFunction defaultAlpha )
-: mAnimation( NULL ),
- mEventThreadServices( eventThreadServices ),
+: mEventThreadServices( eventThreadServices ),
mPlaylist( playlist ),
- mFinishedSignal(),
- mConnectors(),
- mConnectorTargetValues(),
- mPlayRange( Vector2(0.0f,1.0f)),
+ mAnimation( NULL ),
+ mNotificationCount( 0 ),
+ mFinishedCallback( NULL ),
+ mFinishedCallbackObject( NULL ),
mDurationSeconds( durationSeconds ),
mSpeedFactor(1.0f),
- mNotificationCount( 0 ),
mLoopCount(1),
mCurrentLoop(0),
+ mPlayRange( Vector2(0.0f,1.0f)),
mEndAction( endAction ),
mDisconnectAction( disconnectAction ),
mDefaultAlpha( defaultAlpha ),
Dali::Animation handle( this );
mFinishedSignal.Emit( handle );
}
+
+ // This callback is used internally, to avoid the overhead of using a signal.
+ if ( mFinishedCallback )
+ {
+ mFinishedCallback( mFinishedCallbackObject );
+ }
}
bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
return connected;
}
+void Animation::SetFinishedCallback( FinishedCallback callback, Object* object )
+{
+ mFinishedCallback = callback;
+ mFinishedCallbackObject = object;
+}
+
void Animation::AddAnimatorConnector( AnimatorConnectorBase* connector )
{
DALI_ASSERT_DEBUG( NULL != connector );
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.
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);
Property::Value targetValue;
};
- const SceneGraph::Animation* mAnimation;
-
EventThreadServices& mEventThreadServices;
AnimationPlaylist& mPlaylist;
+ const SceneGraph::Animation* mAnimation;
+
+ int mNotificationCount; ///< Keep track of how many Finished signals have been emitted.
+
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
- 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;
+
};
} // namespace Internal