interpolate

Function to interpolate between two numbers. If both start and end are numbers, it calculates the interpolated value based on the parameter t (0 to 1). If either start or end is not a number, it returns the end value directly.

You will typically use this function when implementing custom animations.

t can be outside the (0, 1) range, depending on easing.

This one interpolates only numbers; if you want to interpolate colors or strings then perhaps see d3-interpolate.

Available since Recharts 3.9

Return value

number

Props

  • endnumber

    the final value (when t=1)

  • startnull | number

    the starting value (when t=0)

  • tnumber

    t interpolation factor; values in [0, 1] interpolate between start and end, and values outside that range extrapolate