title: Find curve between two lines in javascript
body: <p>I have a counter counting votes. However, I'm only pulling the number ever 30 seconds from the server. I'd like it to look fairly consistent on the front end, so I've written a little script to keep track of the increases and give it a nice linear increase in votes, multiple times per second. </p>
  
  <p>However, I can't seem to transition between different rates very well - my brain locks up getting past linear.</p>
  
  <p><strong>Example:</strong>
  Lets say we're at 100 votes.</p>
  
  <p>The votes are predicted to increase by 60 over the next 30 seconds, or on a 2 votes per 1 second (2/1). I can get that far already. </p>
  
  <p>We end up 30 seconds later with 160 votes from our linear gain.</p>
  
  <p>Now, the next segment is predicted to increase by only 20 over 30 seconds, or 2 votes per 3 seconds (2/3). </p>
  
  <p>Rather than have a sudden drop in vote rate, I'd like a smooth transition in rate where 30 seconds later I'll have the correct (180) total votes, the counter decelerating (or accelerating, accordingly) rather than just suddenly changing linear gains. </p>
  
  <pre><code>var t = 0;
  function upCount(){
    $("#votecount").text(Math.floor(current + nextInc*(t/60));
    t++;
  }
  </code></pre>
  
  <p><code>current</code> is the current number of votes as reported from the server, and <code>nextInc</code> is the predicted number of votes to occur over the next 30 seconds.</p>
  
  <p><code>t</code> is "time", reset to zero with each ajax pull from the server. This is inside an interval of 500ms.</p>
  
  <p>Maybe I'm going about it all wrong. Crazy ideas welcome. I am allowed to use jQuery here, if it helps.</p>
  
  <p>Thanks!</p>