- //Make sure mElapsedSeconds is within the new range
- mElapsedSeconds = Dali::Clamp(mElapsedSeconds, mPlayRange.x*mDurationSeconds , mPlayRange.y*mDurationSeconds );
+ // Make sure mElapsedSeconds is within the new range
+
+ if( mState == Stopped )
+ {
+ // Ensure that the animation starts at the right place
+ mElapsedSeconds = mPlayRange.x * mDurationSeconds;
+ }
+ else
+ {
+ // If already past the end of the range, but before end of duration, then clamp will
+ // ensure that the animation stops on the next update.
+ // If not yet at the start of the range, clamping will jump to the start
+ mElapsedSeconds = Dali::Clamp(mElapsedSeconds, mPlayRange.x*mDurationSeconds , mPlayRange.y*mDurationSeconds );
+ }