Skip to content

Commit dd8424c

Browse files
committed
Use linear interpolation by default, fix crash if the first frame has t > 0
1 parent 98c4456 commit dd8424c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/app/3d/qgs3danimationsettings.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ float Qgs3DAnimationSettings::duration() const
2929

3030
Qgs3DAnimationSettings::Keyframe Qgs3DAnimationSettings::interpolate( float time ) const
3131
{
32-
Q_ASSERT( !mKeyframes.isEmpty() );
32+
if ( mKeyframes.isEmpty() )
33+
return Keyframe();
3334

34-
if ( time < 0 )
35+
if ( time < mKeyframes.constFirst().time )
3536
{
3637
return mKeyframes.first();
3738
}
38-
else if ( time >= duration() )
39+
else if ( time >= mKeyframes.constLast().time )
3940
{
4041
return mKeyframes.last();
4142
}
@@ -44,7 +45,7 @@ Qgs3DAnimationSettings::Keyframe Qgs3DAnimationSettings::interpolate( float time
4445
// TODO: make easing curves configurable.
4546
// QEasingCurve is probably not flexible enough, we may need more granular
4647
// control with Bezier curves to allow smooth transition at keyframes
47-
QEasingCurve easing( QEasingCurve::InOutQuad );
48+
QEasingCurve easing( QEasingCurve::Linear );
4849

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

0 commit comments

Comments
 (0)