All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.Clamp.kt Maven / Gradle / Ivy

package com.juul.krayon.interpolate

/** Returns an [Interpolator] that wraps `this` such that input fractions are coerced to the range `0f..1f`. */
public fun  Interpolator.clamp(): Interpolator = ClampInterpolator(this)

private class ClampInterpolator(
    private val delegate: Interpolator,
) : Interpolator {
    override fun interpolate(fraction: Float): T = delegate.interpolate(fraction.coerceIn(0f, 1f))
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy