This method of getting interpolated attribute values during a transition uses a timer ( as opposed to a tween function ) which can be started at the beginning of a transition and repeatedly finds the value of a given element's attribute until stopped (this could be stopped by a transition end event itself). The other option using a timer is to use the timer itself to transition an object. This approach can be found in this answer on SO.
https://d3js.org/d3.v4.min.js