Skip to content

Commit

Permalink
Use linear interpolation by default, fix crash if the first frame has…
Browse files Browse the repository at this point in the history
… t > 0
  • Loading branch information
wonder-sk committed Jul 8, 2018
1 parent 98c4456 commit dd8424c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/3d/qgs3danimationsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ float Qgs3DAnimationSettings::duration() const

Qgs3DAnimationSettings::Keyframe Qgs3DAnimationSettings::interpolate( float time ) const
{
Q_ASSERT( !mKeyframes.isEmpty() );
if ( mKeyframes.isEmpty() )
return Keyframe();

if ( time < 0 )
if ( time < mKeyframes.constFirst().time )
{
return mKeyframes.first();
}
else if ( time >= duration() )
else if ( time >= mKeyframes.constLast().time )
{
return mKeyframes.last();
}
Expand All @@ -44,7 +45,7 @@ Qgs3DAnimationSettings::Keyframe Qgs3DAnimationSettings::interpolate( float time
// TODO: make easing curves configurable.
// QEasingCurve is probably not flexible enough, we may need more granular
// control with Bezier curves to allow smooth transition at keyframes
QEasingCurve easing( QEasingCurve::InOutQuad );
QEasingCurve easing( QEasingCurve::Linear );

for ( int i = 0; i < mKeyframes.size() - 1; i++ )
{
Expand Down

0 comments on commit dd8424c

Please sign in to comment.