diff options
author | Linnea Gräf <nea@nea.moe> | 2024-04-26 10:11:23 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-04-26 10:12:18 +0200 |
commit | 041da7c7d179df01c4048a81ddf40a9f13c3ce77 (patch) | |
tree | 6e6933320c8e96a22bfe433b1e33b184948b8fbd /src/main/kotlin/moe/nea/firmament/util/render/LerpUtils.kt | |
parent | c264ca9e8f9f2b0aed457753c43bb4e25edb0ef1 (diff) | |
download | Firmament-041da7c7d179df01c4048a81ddf40a9f13c3ce77.tar.gz Firmament-041da7c7d179df01c4048a81ddf40a9f13c3ce77.tar.bz2 Firmament-041da7c7d179df01c4048a81ddf40a9f13c3ce77.zip |
Add fuel durability bar
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util/render/LerpUtils.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/render/LerpUtils.kt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/render/LerpUtils.kt b/src/main/kotlin/moe/nea/firmament/util/render/LerpUtils.kt index a979f8d..66899ce 100644 --- a/src/main/kotlin/moe/nea/firmament/util/render/LerpUtils.kt +++ b/src/main/kotlin/moe/nea/firmament/util/render/LerpUtils.kt @@ -6,6 +6,8 @@ package moe.nea.firmament.util.render +import me.shedaniel.math.Color + val pi = Math.PI val tau = Math.PI * 2 fun lerpAngle(a: Float, b: Float, progress: Float): Float { @@ -17,7 +19,20 @@ fun lerpAngle(a: Float, b: Float, progress: Float): Float { fun lerp(a: Float, b: Float, progress: Float): Float { return a + (b - a) * progress } +fun lerp(a: Int, b: Int, progress: Float): Int { + return (a + (b - a) * progress).toInt() +} fun ilerp(a: Float, b: Float, value: Float): Float { return (value - a) / (b - a) } + +fun lerp(a: Color, b: Color, progress: Float): Color { + return Color.ofRGBA( + lerp(a.red, b.red, progress), + lerp(a.green, b.green, progress), + lerp(a.blue, b.blue, progress), + lerp(a.alpha, b.alpha, progress), + ) +} + |