For example I have a transition:
var sel = container.selectAll('div')
.transition()
.duration(1000)
.attr('transform', 'translate(100,500)');
At some moment I need to know where some of the elements lands to, e.g.
setTimeout(() => {
var value = d3.select('div#target')
.expectedAttr('transform');
assertEqual(value, 'translate(100,500)');
}, 500);
Is there built-in feature like this in D3? Otherwise I will have to write my own wrapper over d3.transition().attr()
method for storing values passed to it.
Edit
I've found out that D3 creates __transition__
field on elements, which seems to contain info regarding the transition, but I see no way to find a target attribute value there.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…