Function scaleLinear

  • @description: 比例计算 @author: wxingheng @Date: 2022-09-30 11:13:27

    Parameters

    • value: number

      当前值

    • source: number

      当前值所在的区间

    • target: number

      目标区间

    • toFixedLength: any = 2

      保留小数位数

    Returns any

    @example: scaleLinear(50, 100, 10, 2) => 5; scaleLinear(50, 100, 10, 0) => 5;