With interpolation, you can obtain intermediate values between a pair of values. The d3-interpolate module contains functions that create interpolator functions for colors, numbers, strings, arrays, and objects. The main functions are listed as follows:
Function |
Description |
d3.interpolateNumber(a,b) |
Returns a numeric interpolator between numeric values a and b. Avoid using zero (use 1e-6 instead, whenever possible). |
d3.interpolateRound(a,b) |
Similar to d3.interpolateNumber(), but rounds the value to the nearest integer. |
d3.interpolateString(a,b) |
Returns an interpolator that finds numbers embedded in b and looks for a corresponding number in a, then creates a numeric interpolator for each one, using static parts of the string and unmatched numbers as a template. |
d3.interpolateDate(a,b) |
Returns a date interpolator between dates a and b... |