This method of getting interpolated values during a transition uses a tween function which is normally used for a custom interpolation, but in this case is applied to a dummy attribute that we don't want to change. Instead, we just want to use the tween function to do something else, in this case get the cx
value of the circle.
An alternative approach is to use a timer to constantly find the current attribute values during a transition, or alternatively, to conduct the transition itself.
https://d3js.org/d3.v4.min.js