title: Javascript timer progress bar
body: <p>I have timer function, with progress bar. It works well, but I want make a smooth progress bar animation, with 60 FPS</p>
  
  <pre><code>function started(duration) {
      var TotalSeconds = 40;
      var documentWidth = $(document).width();
      var start = Date.now();
      var intervalSetted = null;
  
      function timer() {
          var diff = duration - (((Date.now() - start) / 1000) | 0);
          var seconds = (diff % 60) | 0;
          seconds = seconds &lt; 10 ? "0" + seconds : seconds;
          $('#timer').html("00:" + seconds);
          var progresBarWidth = (seconds * documentWidth / TotalSeconds);
  
          $('#progress').css({
              width: progresBarWidth + 'px'
          });
  
          if (diff &lt;= 0) {
              clearInterval(intervalSetted);
          }
      }
  
      timer();
      intervalSetted = setInterval(timer, 1000);
  }
  
  started(40);
  </code></pre>
  
  <p>How can I achieve 60FPS animation?</p>
  
  <p>Here is demo of my code: <a href="https://jsfiddle.net/63zdj6xh/" rel="noreferrer">JSFiddle</a>!</p>