From 68dcfc249ef35fac4dadc60c3daa7433d212bc4b Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 1 Oct 2007 23:18:56 +0000 Subject: [PATCH] Make the linear interpolation linear. See http://dooglus.rincevent.net/synfig/linear.sifz for an example of how linear interpolation currently works. Both circles are animated over the same distance with identical waypoints, but one of them has an extra linear waypoint at frame zero. That extra waypoints makes its entire movement non-linear. git-svn-id: http://svn.voria.com/code@809 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/valuenode_animated.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/synfig-core/trunk/src/synfig/valuenode_animated.cpp b/synfig-core/trunk/src/synfig/valuenode_animated.cpp index 3bb0146..1c37cbe 100644 --- a/synfig-core/trunk/src/synfig/valuenode_animated.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_animated.cpp @@ -455,17 +455,16 @@ public: // Adjust for time const float timeadjust(0.5); - if(!curve_list.empty()) - curve.second.t1()*=(curve.second.get_dt()*(timeadjust+1))/(curve.second.get_dt()*timeadjust+curve_list.back().second.get_dt()); - if(after_next!=waypoint_list_.end()) - curve.second.t2()*=(curve.second.get_dt()*(timeadjust+1))/(curve.second.get_dt()*timeadjust+(after_next->get_time()-next->get_time())); - if(iter_get_after==INTERPOLATION_HALT) curve.second.t1()*=0; + else if(iter_get_after != INTERPOLATION_LINEAR && !curve_list.empty()) + curve.second.t1()*=(curve.second.get_dt()*(timeadjust+1))/(curve.second.get_dt()*timeadjust+curve_list.back().second.get_dt()); if(next_get_before==INTERPOLATION_HALT) curve.second.t2()*=0; - } + else if(next_get_before != INTERPOLATION_LINEAR && after_next!=waypoint_list_.end()) + curve.second.t2()*=(curve.second.get_dt()*(timeadjust+1))/(curve.second.get_dt()*timeadjust+(after_next->get_time()-next->get_time())); + } // not CONSTANT } // Set up the time to the default stuff -- 2.7.4