Function clamp

Clamps a value between a minimum and maximum value.

  • Parameters

    • val: number

      The value to be clamped.

    • min: number = 0

      The minimum value.

    • max: number = 1

      The maximum value.

    Returns number

    The clamped value.