title: Call a function each x second in requestAnimationFrame
body: <p>I'm working on some personal project by Three.js. I'm using <code>requestAnimationFrame</code> function. I want to call a function each 2 seconds. I've search but I couldn't find anything useful.<br><br>
  My code is like this:</p>
  
  <pre><code>function render() {
     // each 2 seconds call the createNewObject() function
     if(eachTwoSecond) {
        createNewObject();
     }
     requestAnimationFrame(render);
     renderer.render(scene, camera);
  }
  </code></pre>
  
  <p>Any Idea?</p>