Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public void TestAnimations()
Property = nameof(TestControl.Foo),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(0f, 0f), // This is the common way to specify the first keyframe.
new AnimationTrackProperty.KeyFrame(1f, 1f),
new AnimationTrackProperty.KeyFrame(3f, 2f)
}
Expand All @@ -168,7 +169,7 @@ public void TestAnimations()
control.PlayAnimation(animation, "foo");
control.DoFrameUpdateRecursive(new FrameEventArgs(0.5f));

Assert.That(control.Foo, new ApproxEqualityConstraint(0f)); // Should still be 0.
Assert.That(control.Foo, new ApproxEqualityConstraint(0.5f)); // Should be 0.5 as half a second elapsed and our 1s keyframe is at 1.

control.DoFrameUpdateRecursive(new FrameEventArgs(0.5001f));

Expand Down
4 changes: 3 additions & 1 deletion Robust.Client/Animations/AnimationTrackProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public override (int KeyFrameIndex, float FramePlayingTime) AdvancePlayback(obje
var nextKeyFrame = keyFrameIndex + 1;
if (nextKeyFrame == 0)
{
// Still before the first keyframe, do nothing.
// At the start snap the anim to the first keyframe
value = KeyFrames[0].Value;
ApplyProperty(context, value);
return (keyFrameIndex, playingTime);
}

Expand Down
Loading