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