title: Moving circles randomly created using D3.js
body: <p>I have developed a web application using D3.js in which there are 100 circles. I want the circles to move slightly (by 2px randomly) and smoothly all the time.</p>
  
  <p>Here is what I have tried using jQuery:</p>
  
  <pre><code>setInterval(function() {
      $('.circle_Negative').each(function() {
          var newq = makeNewPosition();
          $(this).animate({ cx: +$(this).attr("cx")+newq[0], cy: +$(this).attr("cy")+newq[1] },200);
  
      });
  }, 200);
  
  function makeNewPosition() {
      var nh = Math.floor(Math.random()*2);
      var nw = Math.floor(Math.random()*2);
  
      return [nh,nw];    
  }
  </code></pre>
  
  <p>But this is not at all smooth. I think there could be better ways by which it can be done using D3 itself but I could not figure out much.</p>