Skip to content

Commit

Permalink
Update interpolation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Jul 9, 2018
1 parent d70c37c commit 57855cc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/app/3d/qgs3danimationsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,14 @@ Qgs3DAnimationSettings::Keyframe Qgs3DAnimationSettings::interpolate( float time
// QEasingCurve is probably not flexible enough, we may need more granular
// control with Bezier curves to allow smooth transition at keyframes

float totalTime = duration();
float interpTime = mEasingCurve.valueForProgress( time / totalTime );
float time2 = interpTime * totalTime;

for ( int i = 0; i < mKeyframes.size() - 1; i++ )
{
const Keyframe &k0 = mKeyframes.at( i );
const Keyframe &k1 = mKeyframes.at( i + 1 );
if ( time2 >= k0.time && time2 <= k1.time )
if ( time >= k0.time && time <= k1.time )
{
float eIp = ( time2 - k0.time ) / ( k1.time - k0.time );
float ip = ( time - k0.time ) / ( k1.time - k0.time );
float eIp = mEasingCurve.valueForProgress( ip );
float eIip = 1.0f - eIp;

Keyframe kf;
Expand Down

0 comments on commit 57855cc

Please sign in to comment.