API

Function Clamp

  • Returns the value itself if it's between min and max. Returns min if the value is lower than min. Returns max if the value is greater than max.

    Parameters

    • value: number

      the value to clmap

    • min: number = 0

      the min value to clamp to (default: 0)

    • max: number = 1

      the max value to clamp to (default: 1)

    Returns number

    the clamped value