title: Java Script Image Slide Show (Annimate function)
body: <p>I have a problem understanding javascript code.These are my first steps in javascript and I'm trying to make a Javascript slide show. Please explain me how </p>
  
  <pre><code>var timePassed = new Date - start; **and**
  var progress = timePassed / opts.duration;
  </code></pre>
  
  <p>works in this function:-</p>
  
  <pre><code>&lt;script&gt;
  function animate(opts){
  var start = new Date;
  var id = setInterval(function(){
      var timePassed = new Date - start;
      var progress = timePassed / opts.duration;
      if (progress &gt; 1){
          progress = 1;
      }
      var delta = opts.delta(progress);
      opts.step(delta);
      if (progress == 1){
          clearInterval(id);
          opts.callback();
      }
  }, opts.delay || 17);
  
  }
  
  &lt;/script&gt;
  </code></pre>