title: CABasicAnimation speed -- Keeping up with user input
body: <p>Update: It really was as simple as not animating the UI element when utilizing touches. It perfectly follows touches now with no lag.</p>
  
  <p>I'm currently attempting to implement a UI feature by implementing a CALayer subclass inside of a UIView subclass. I receive touch events in the custom UIVIew's corresponding view controller, notify the UIView about the touches, which in turn notifies the CALayer in order to animate the UI elements drawn in the layer.</p>
  
  <p>It all works, but I have noticed that when there is a big delta in movement (as in when quickly scrolling a finger), the CABasicAnimation lags behind. Ideally I want the animation to stay perfectly aligned with the user's finger.</p>
  
  <p>I've come up with a hacky way of just setting the animation's speed arbitrarily high as in</p>
  
  <pre><code>anim.speed = 10.0f;
  </code></pre>
  
  <p>which essentially keeps up with the user's finger, but I feel that this is a total hack and not a shippable solution. Should I be artificially limiting how many touch events are processed in order to solve this problem? Is there some sort of calculation I should be doing for the speed/duration of the animation that I'm not aware of?</p>
  
  <p>Thanks for any help with this!</p>