I am interested in continually accessing the attributes of dynamic svg elements (such as a rect
) in a d3 visualization created in Observable.
Outside of observable this would be as simple as using document.getElementById().getAttribute();
and a setInterval
from the rendered d3 visualization. But d3 visualizations in Observable return an svg.node()
. I am new to JS and couldn’t figure out how to parse through the node to get the attributes i was interested in.
To elaborate more on my use case. I am interested in using the position of d3 svg elements (e.g. points on a graph) to dynamically control the frequency of an oscillator in Tone.js. Specifcally I am interested in tracking the position of points as they move through a transition()
in d3 and feeding that constantly changing number into the frequency value of an oscillator.
Thank you for your help.