interpolate

Function to interpolate between two numbers. If both start and end are numbers, it calculates the interpolated value based on the parameter animationElapsedTime (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.

animationElapsedTime 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

  • animationElapsedTimenumber

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

  • endnumber

    the final value (when animationElapsedTime=1)

  • startnull | number

    the starting value (when animationElapsedTime=0)