We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53a4f91 commit 721d118Copy full SHA for 721d118
Source/RunActivity/Viewer3D/AnimatedPart.cs
@@ -130,9 +130,16 @@ public void SetFrameCycle(float frame)
130
public void SetFrameWrap(float frame)
131
{
132
// Wrap the frame around 0-MaxFrame without hanging when MaxFrame=0.
133
- while (MaxFrame > 0 && frame < 0) frame += MaxFrame;
134
- if (frame < 0) frame = 0;
135
- frame %= MaxFrame;
+ if (MaxFrame > 0)
+ {
+ frame %= MaxFrame;
136
+ // If frame was negative (eg: animation run in reverse), it will still be negative
137
+ // and needs one additional offset by MaxFrame to be in the correct range
138
+ if (frame < 0)
139
+ frame += MaxFrame;
140
+ }
141
+ else if (frame < 0)
142
+ frame = 0;
143
SetFrame(frame);
144
}
145
0 commit comments