press tab to bring up the game menu

This commit is contained in:
minjaesong
2021-09-26 15:34:24 +09:00
parent 3680047e9a
commit 0e5c86ad04
10 changed files with 120 additions and 50 deletions

View File

@@ -1,6 +1,7 @@
package net.torvald.terrarum.ui
import com.jme3.math.FastMath
import net.torvald.terrarum.sqr
/**
* Created by minjaesong on 2016-03-22.
@@ -26,5 +27,19 @@ object Movement{
if (scale < 0f) start
else if (scale > 1f) end
else (start - end) * FastMath.cos2(0.5f * FastMath.PI * scale) + end
fun moveQuick(start: Float, end: Float, timer: Float, duration: Float) =
(start - end) * ((timer / duration) - 1).sqr() + end
fun moveLinear(start: Float, end: Float, timer: Float, duration: Float): Float {
val scale = timer / duration
if (start == end) {
return start
}
if (scale <= 0f) {
return start
}
if (scale >= 1f) {
return end
}
return ((1f - scale) * start) + (scale * end)
}
}