mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
keycap font, edit on Thai font, actor can now flagged to despawn, draft for projectile "actor"
Former-commit-id: 5a46366ac1680f040fe6e5ace742b71a86982efa Former-commit-id: 30e481f10cc8c09d4fc4ff1f52a4a45d91e3ab2d
This commit is contained in:
30
src/net/torvald/terrarum/ui/Movement.kt
Normal file
30
src/net/torvald/terrarum/ui/Movement.kt
Normal file
@@ -0,0 +1,30 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-22.
|
||||
*/
|
||||
object Movement{
|
||||
/**
|
||||
* Fast at the beginning, getting slow over time.
|
||||
*/
|
||||
fun fastPullOut(scale: Float, start: Float = 0f, end: Float = 1f): Float =
|
||||
if (scale < 0f) start
|
||||
else if (scale > 1f) end
|
||||
else (start - end) * FastMath.sqr(scale - 1) + end
|
||||
|
||||
/**
|
||||
* Slow at the beginning, getting fast over time.
|
||||
*/
|
||||
fun dropDown(scale: Float, start: Float = 0f, end: Float = 1f): Float =
|
||||
if (scale < 0f) start
|
||||
else if (scale > 1f) end
|
||||
else (end - start) * FastMath.sqr(scale) + start
|
||||
|
||||
fun sinusoid(scale: Float, start: Float = 0f, end: Float = 1f): Float =
|
||||
if (scale < 0f) start
|
||||
else if (scale > 1f) end
|
||||
else (start - end) * FastMath.cos2(0.5f * FastMath.PI * scale) + end
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user