Skip to content
Permalink
Browse files

Use linear interpolation by default, fix crash if the first frame has…

… t > 0
  • Loading branch information
wonder-sk committed Jul 5, 2018
1 parent 98c4456 commit dd8424ccadb9d14cf8a5761feaaecefadc2eb22d
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/app/3d/qgs3danimationsettings.cpp
@@ -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();
}
@@ -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++ )
{

0 comments on commit dd8424c

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