added some new params to Particle
This commit is contained in:
@@ -170,18 +170,9 @@ fun lerp(x: Float, y: Float, t: Float) : Float {
|
||||
}
|
||||
|
||||
|
||||
fun interpolateCurve(start: Vector3f, end: Vector3f, t: Float, curve: LerpCurves): Vector3f {
|
||||
val clampedT = t.coerceIn(0.0f, 1.0f)
|
||||
|
||||
val curvedT = curve.function(clampedT)
|
||||
|
||||
val interpolatedVec = Vector3f(
|
||||
lerp(start.x, end.x, curvedT),
|
||||
lerp(start.y, end.y, curvedT),
|
||||
lerp(start.z, end.z, curvedT)
|
||||
)
|
||||
|
||||
return interpolatedVec
|
||||
fun lerpArray(array: Array<Any>, t: Float, curve: LerpCurves = LerpCurves.Linear) : Any {
|
||||
val idx = round(lerp(0.0f, array.lastIndex.toFloat(), t) * curve.function(t)).toInt()
|
||||
return array[idx]
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user