title: Strange behavior animating a UIView using [UIView animateKeyframesWithDuration]
body: <p>I'm trying to create an effect where three arrows go from visible to invisible alternatively.</p>
  
  <p>I made a simple algorithm where every arrow would start from a different alpha value (if there is 3 arrows, the first one would start at alpha=1, the second one at alpha=0.6667, the third one at alpha=0.3337). I then start a key frame animation that:</p>
  
  <ul>
  <li>Change the arrow opacity from its current alpha to 0 (the duration is computed)</li>
  <li>Set instantly the arrow opacity to 1</li>
  <li>Change the arrow opacity from 1 to the first value set</li>
  </ul>
  
  <p>However it seems that some step are skipped for some reason.</p>
  
  <p>A simple example:</p>
  
  <pre><code>[UIView animateKeyframesWithDuration:2 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeLinear | UIViewKeyframeAnimationOptionRepeat animations:^{
  
      [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:0 animations:^{
          _animatedView.alpha = 0.5;
      }];
  
      [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:0.5 animations:^{
          _animatedView.alpha = 0;
      }];
  
      [UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:0 animations:^{
          _animatedView.alpha = 1;
      }];
  
      [UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:0.5 animations:^{
          _animatedView.alpha = 0.5;
      }];
  
  } completion:nil];
  </code></pre>
  
  <p>In that case it should go to 0.5 instantly, 0.5 to 0 in 1 second, go to 1 instantly, 1 to 0.5 in 1 second. It should therefore do a seamless transition that looks like the view is appearing and disappearing but it looks like the animation gets stuck on alpha=0.5 for a few time.</p>
  
  <p>Theoretically, the effect should be the same as if using this key frame animation:</p>
  
  <pre><code>[UIView animateKeyframesWithDuration:2 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeLinear | UIViewKeyframeAnimationOptionRepeat animations:^{
      [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:0 animations:^{
          _animatedView.alpha = 1;
      }];
      [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1 animations:^{
          _animatedView.alpha = 0;
      }];
  } completion:nil];
  </code></pre>