Skip to content

Commit 57855cc

Browse files
committedJul 9, 2018
Update interpolation logic
1 parent d70c37c commit 57855cc

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed
 

‎src/app/3d/qgs3danimationsettings.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,14 @@ Qgs3DAnimationSettings::Keyframe Qgs3DAnimationSettings::interpolate( float time
4646
// QEasingCurve is probably not flexible enough, we may need more granular
4747
// control with Bezier curves to allow smooth transition at keyframes
4848

49-
float totalTime = duration();
50-
float interpTime = mEasingCurve.valueForProgress( time / totalTime );
51-
float time2 = interpTime * totalTime;
52-
5349
for ( int i = 0; i < mKeyframes.size() - 1; i++ )
5450
{
5551
const Keyframe &k0 = mKeyframes.at( i );
5652
const Keyframe &k1 = mKeyframes.at( i + 1 );
57-
if ( time2 >= k0.time && time2 <= k1.time )
53+
if ( time >= k0.time && time <= k1.time )
5854
{
59-
float eIp = ( time2 - k0.time ) / ( k1.time - k0.time );
55+
float ip = ( time - k0.time ) / ( k1.time - k0.time );
56+
float eIp = mEasingCurve.valueForProgress( ip );
6057
float eIip = 1.0f - eIp;
6158

6259
Keyframe kf;

0 commit comments

Comments
 (0)
Please sign in to comment.