Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make a D3 force layout continually move?

Is there a way to may a d3 force layout continually move even after it has "cooled"? I have been using this but the movement is very minor:

svg.on('mousemove', function() {
   force.start();
});
like image 360
Rozgonyi Avatar asked Mar 17 '23 04:03

Rozgonyi


1 Answers

I actually figured it out on my own with this:

setInterval(function(){force.alpha(0.1);},250);

That's probably not the most performant on a large layout but it provides a nice continual drift on my force layout of 20 nodes.

like image 99
Rozgonyi Avatar answered Apr 28 '23 13:04

Rozgonyi