You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transitions currently use the internal d3_timer_active variable to reschedule the active timer and replace its callback function. It’d be nice if we made these methods public so that you can easily stub out the d3.timer API or use similar functionality when implementing complex custom animations.
Have you also considered d3.timer maintaining a timers by name array? Or timers by id maybe. It would be good if d3.timer returned an id and maintained a list, this would round out the proposed api nicely. It would also allow better management of the timer in the force layout for example. Currently, if you .stop() a force layout and restart it before force.tick() is called, you end up with two timers, both hitting the same call-back and the animation runs at double speed.
Activity
cool-Blue commentedon Apr 30, 2015
Have you also considered d3.timer maintaining a timers by name array? Or timers by id maybe. It would be good if
d3.timerreturned an id and maintained a list, this would round out the proposed api nicely. It would also allow better management of the timer in the force layout for example. Currently, if you.stop()a force layout and restart it beforeforce.tick()is called, you end up with two timers, both hitting the same call-back and the animation runs at double speed.mbostock commentedon Oct 22, 2015
In 4.0, I’m planning on having d3.timer return a handle so that you can modify and cancel timers outside of the callback; see d3/d3-timer#5.
mbostock commentedon Mar 1, 2016
Closing as fixed in d3-timer for 4.0.