From: Julien Heanley Date: Mon, 24 Mar 2014 14:11:11 +0000 (+0000) Subject: (Animation) Fix for issue in keyframed animation when only 1 key frame present X-Git-Tag: dali-2014-wk16-release~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cb99c3546ecdecf0d0036a00baf4a5e42b8eaee;p=platform%2Fcore%2Fuifw%2Fdali-core.git (Animation) Fix for issue in keyframed animation when only 1 key frame present [Issue#] N/A [Problem] Keyframe was not affecting property value [Cause] key frames only affect property if current progress is between first and last key frame (if only 1 key frame then it uses same time for first and last) [Solution] if progress is greater than last key frame time then set property to last key frame Signed-off-by: Paul Wisbey --- diff --git a/dali/internal/event/animation/key-frame-channel.h b/dali/internal/event/animation/key-frame-channel.h index 8f40e9b..4713435 100644 --- a/dali/internal/event/animation/key-frame-channel.h +++ b/dali/internal/event/animation/key-frame-channel.h @@ -90,9 +90,8 @@ bool KeyFrameChannel::IsActive (float progress) if(!mValues.empty()) { ProgressValue& first = mValues.front(); - ProgressValue& last = mValues.back(); - if (progress >= first.GetProgress() && progress <= last.GetProgress() ) + if( progress >= first.GetProgress() ) { active = true; } @@ -146,21 +145,17 @@ V KeyFrameChannel::GetValue (float progress) const typename std::vector >::iterator start; typename std::vector >::iterator end; - V interpolatedV; - if(FindInterval(start, end, progress)) + V interpolatedV = firstPV.GetValue(); + if(progress >= mValues.back().GetProgress() ) + { + interpolatedV = mValues.back().GetValue(); // This should probably be last value... + } + else if(FindInterval(start, end, progress)) { float frameProgress = (progress - start->GetProgress()) / (end->GetProgress() - start->GetProgress()); interpolatedV = Interpolate(*start, *end, frameProgress); } - else if(progress <= firstPV.GetProgress()) - { - interpolatedV = firstPV.GetValue(); // This should probably be initial value... - } - else - { - interpolatedV = mValues.back().GetValue(); // Sticks at end value - } return interpolatedV; }