title: Ease-In Ease-Out function
body: <p>I'm wanting an easing function equivalent to UIViewAnimationCurveEaseInOut, but don't see that Apple exposes that as a function.</p>
  
  <p>I've tried <a href="https://stackoverflow.com/questions/8316882/what-is-an-easing-function">the easeInOutQuad function posted here</a> with no success.  My Objective-C version of that function is:</p>
  
  <pre><code>-(float) getEaseInOutValueWithElapsedMillis: (float) t startValue: (float) b endValue: (float) c andTotalMillis: (float) d {
     float   value =0.0f;
  
     if ((t/=d/2.0f) &lt;1.0f)
        value =c/2.0f*t*t + b;
     else
        value =-c/2.0f * ((--t)*(t-2.0f) - 1.0f) + b;
  
     debug(@"t=%f b=%f c=%f d=%f value=%f", t, b, c, d, value);
     return value;
  }
  </code></pre>
  
  <p>And the logged results are:</p>
  
  <p>When the start value is less than the end value:</p>
  
  <pre><code>t=0.066467 b=110.000000 c=225.000000 d=500.000000 value=110.497017
  t=0.133133 b=110.000000 c=225.000000 d=500.000000 value=111.993996
  t=0.199799 b=110.000000 c=225.000000 d=500.000000 value=114.490944
  ...
  t=0.999786 b=110.000000 c=225.000000 d=500.000000 value=222.451935
  t=0.066452 b=110.000000 c=225.000000 d=500.000000 value=236.954926
  t=0.133118 b=110.000000 c=225.000000 d=500.000000 value=250.457932
  ... (note that value shot right past c)
  t=0.866440 b=110.000000 c=225.000000 d=500.000000 value=332.993195
  t=0.933105 b=110.000000 c=225.000000 d=500.000000 value=334.496582
  t=0.999771 b=110.000000 c=225.000000 d=500.000000 value=335.000000
  </code></pre>
  
  <p>And the 100% value ends up as b +c, rather than c.</p>
  
  <p>When the start value is greater than the end value:</p>
  
  <pre><code>t=0.047389 b=225.000000 c=110.000000 d=700.000000 value=225.123520
  t=0.095008 b=225.000000 c=110.000000 d=700.000000 value=225.496460
  ...
  t=0.904504 b=225.000000 c=110.000000 d=700.000000 value=334.498413
  t=0.952122 b=225.000000 c=110.000000 d=700.000000 value=334.873932
  t=0.999740 b=225.000000 c=110.000000 d=700.000000 value=335.000000
  </code></pre>
  
  <p>Again, the 100% value ends up as b +c, rather than c.</p>
  
  <p>Perhaps I've mangled the code.  How can I achieve a proper ease-in ease-out?</p>