Skip to content
Permalink
Browse files

Update interpolation logic

  • Loading branch information
wonder-sk committed Jul 9, 2018
1 parent d70c37c commit 57855cc4927eb163d90be8dcc65771015a32a68c
Showing with 3 additions and 6 deletions.
  1. +3 −6 src/app/3d/qgs3danimationsettings.cpp
@@ -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;

0 comments on commit 57855cc

Please sign in to comment.
You can’t perform that action at this time.