title: Calculate the color at a given point on a gradient between two colors?
body: <p>So this is essentially the method I would like to write (in Objective-C/Cocoa, using <code>UIColors</code>, but I'm really just interested in the underlying math):</p>
  
  <pre><code>+ (UIColor *)colorBetweenColor:(UIColor *)startColor andColor:(UIColor *)endColor atLocation:(CGFloat)location;
  </code></pre>
  
  <p>So as an example, say I have two colors, pure red and pure blue. Given a linear gradient between the two, I want to calculate the color that's at, say, the 33% mark on that gradient:
  <img src="https://i.stack.imgur.com/Uh7Zf.png" alt="Example">
  <br>
  So if I were to call my method like so:</p>
  
  <pre><code>UIColor *resultingColor = [UIColor colorBetweenColor:[UIColor redColor] andColor:[UIColor blueColor] atLocation:0.33f];
  </code></pre>
  
  <p>I would get the resulting color at 'B', and similarly, passing <code>0.0f</code> as the location would return color 'A', and <code>1.0f</code> would return color 'C'.</p>
  
  <p>So basically my question is, how would I go about mixing the RGB values of two colors and determining the color at a certain 'location' between them?</p>