Function batchInterpolateNumber

  • Given an Array of numbers, estimate the resulting number, at a t value between 0 to 1

    Basic interpolation works by scaling t from 0 - 1, to some start number and end number, in this case lets use 0 as our start number and 100 as our end number, so, basic interpolation would interpolate between 0 to 100.

    If we use a t of 0.5, the interpolated value between 0 to 100, is 50. batchInterpolateNumber takes it further, by allowing you to interpolate with more than 2 values, it allows for multiple values. E.g. Given an Array of values [0, 100, 0], and a t of 0.5, the interpolated value would become 100.

    Based on d3.interpolateBasis [], check out the link above for more detail.

    Buliding on-top of batchInterpolateNumber, interpolateNumberBatch interpolates between numbers, but unlike batchInterpolateNumber interpolateNumberBatch uses an Array of t instances to generate an array of interpolated values


    Source code of interpolateNumberBatch


    • arr_t: number[]

      Array of numbers (between 0 to 1) which each represent an instant of the interpolation

    • values: number[]

      Array of numbers to interpolate between

    • decimal: number = 3

      How many decimals should the interpolated value have

    Returns number[]

    Array of interpolated numbers at different instances

Generated using TypeDoc