Tracking Active transition

Is there a way in d3 to track if a transition is still running inside an interval?

My end goal is to be able to make a callback inside d3.interval until that particular transaction is finished.

I am currently doing it like this. Is there a better way of doing it?

Thank you in advance.

see transition.end

Hi @Fil , thanks for looking into it. As I understand transition.end is very useful for sequencing. However, I intend to run a callback at a fixed interval while the animation is running. I also want the interval to stop when the transition finishes. How can transition.end be useful in that regrad?

For example:

  const transition = circ
    .transition()
    .duration(1000)
    .ease((t) => t);

  transition.tween("_", function () {
    return function (t) {
      circ.attr("r", d3.interpolateNumber(200, 0)(t));
    };
  }).end().then(() => ticker.stop());

  const ticker = d3.interval((e) => {
    mutable debug = Date.now();
  });
1 Like