Display value of d3.interpolate
d3.js, html, javascript, jquery, transition
Solution
The d3.interpolate method receives the beginning and end values of the transition, and returns an interpolator function. An interpolator function receives a value between 0 and 1, and returns the interpolated value. For instance:
// Create an interpolator function to compute intermediate colors between blue and red
var i = d3.interpolate('blue', 'red');
// Evaluate the interpolator
console.log(i(0.0)); // #0000ff - blue
console.log(i(0.4)); // #cc0033 - purple
console.log(i(1.0)); // #ff0000 - red
Problem
I am quite new to `d3.js`. I am trying to understand the following code: ``` .tween("text", function(d) { var i = d3.interpolate(this.textContent, d), prec = (d + "").split("."), round = (prec.length > 1) ? Math.pow(10, prec[1].length) : 1; console.log(i); return function(t) { this.textContent = Math.round(i(t) * round) / round; }; }); ``` I want to see the value of `var i`, so if I am doing `console.log(i)`, I am getting some equation returned. How can I see the interpolated value?