gradum-kit - v0.1.0
    Preparing search index...

    Function linearInterpolation

    • Function

      linearInterpolation

      Parameters

      • x: number

        The input value to map.

      • x1: number

        Start of the input range.

      • x2: number

        End of the input range.

      • y1: number

        Value returned when x equals x1.

      • y2: number

        Value returned when x equals x2.

      • Optionalstrict: boolean = true

        Whether to clamp x into [x1, x2] first. Set it to false to allow extrapolation beyond the given range.

      Returns number

      The interpolated value.

      Map a value from one range onto another, along the straight line through (x1, y1) and (x2, y2). Useful for turning a position into a ratio, a ratio into a size, and so on.