title: implementing easing function
body: <p>I'm trying to port and implement an easing function I found</p>
  
  <h2>EDIT</h2>
  
  <p>: I pasted in the wrong easing function, Sorry! Here is the correct one:</p>
  
  <pre><code>Math.easeOutQuart = function (t, b, c, d) {
      t /= d;
      t--;
      return -c * (t*t*t*t - 1) + b;
  };
  </code></pre>
  
  <hr>
  
  <p>The language i'm using is not Flash or Actionscript. Here is my code:</p>
  
  <pre><code>ease:{outquart:{function(t as float,b as float,c as float,d as float) as float
          t=t/d
          t=t-1
          return -c * (t*t*t*t - 1) + b
      end function}}
  </code></pre>
  
  <p>I'm calling the function in a loop with:</p>
  
  <h2>EDIT2 - the calling function.</h2>
  
  <p>m.move is set to 1 or -1 for direction to move, or -5 +5 to move by 5 lengths.
  setspritemoves is called as often as possible, currently it is as fast as the system can call, but I could trigger the call on a millisecond timer.</p>
  
  <pre><code>setspritemoves:function()
                  if m.move=1 then
                  m.duration=1
                      if m.ishd then
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]+m.move*324
                          next i
                      else
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]+m.move*224
                          next i
                      end if                          
                  else if m.move=5 then
                      m.duration=5
                      if m.ishd then
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]+m.move*324
                          next i
                      else
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]+m.move*224
                          next i
                      end if      
                  else if m.move=-1 then
                  m.duration=1
                      if m.ishd then
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]-m.move*324
                          next i
                      else
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]-m.move*224
                          next i
                      end if      
                  else if m.move=-5 then
                      m.duration=5
                      if m.ishd then
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]-m.move*324
                          next i
                      else
                          for i=0 to m.spriteposx.count()-1
                              m.moveto[i]=m.spriteposx[i]-m.move*224
                          next i
                      end if
                  end if
                  end function
  </code></pre>
  
  <p>m.moveto[i] is the destination x coordinate, m.time is an integer I increment, m.duration is what I assume to be the amount of time I want the change to take to complete, m.spriteposx is the current position of the object I'm moving. [i] is the current sprite.</p>
  
  <p>What should the increment value be for time what should the duration be, if I want to move 345 pixels in 1/2 second? </p>
  
  <p>In all my experiments, I either overshoot by a huge factor, or only move a few pixels.</p>
  
  <p>currently m.time is incremented by 1 every iteration, and m.duration is 100. I"ve tried all kinds of values and none seems to work consistently.</p>