Fix non looping animation being broken
This commit is contained in:
parent
d87e672fe7
commit
7504c1381d
@ -56,7 +56,7 @@ class FrameSetAnimator(
|
||||
if (frameDiff == 0)
|
||||
return
|
||||
|
||||
if (frame + frameDiff >= lastFrame && !animationLoops) {
|
||||
if (frame + firstFrame >= lastFrame && !animationLoops) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -64,8 +64,14 @@ class FrameSetAnimator(
|
||||
lastRender = glfwGetTime()
|
||||
|
||||
if (counter >= 1.0) {
|
||||
frame = (frame + counter.toInt()) % frameDiff
|
||||
counter %= 1.0
|
||||
val desired = frame + counter.toInt()
|
||||
|
||||
if (animationLoops || desired + firstFrame < lastFrame) {
|
||||
frame = desired % frameDiff
|
||||
counter %= 1.0
|
||||
} else {
|
||||
frame = lastFrame - firstFrame
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user