title: problem using CABasicAnimation to animate multiple CALayers
body: <p>I've been having lots of problems with animations in my board game iPhone app. i use the following function to animate the computer player moving the counter:</p>
  
  <pre><code>-(void)animateCounterMoveFor:(int)playerType counterId:(int)countId {
  
      // set up the move to an end point
      CABasicAnimation *move = [CABasicAnimation animationWithKeyPath:@"position"];
      [move setDuration:3.5];
      [move setToValue:[NSValue valueWithCGPoint:CGPointMake((xPos), (yPos))]];
      [move setFillMode:kCAFillModeForwards];
      [move setRemovedOnCompletion:NO];
      CAMediaTimingFunction *tf = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
      [move setTimingFunction:tf];
  
      // enable the animation stop to set layer to right position
      [move setValue:[NSNumber numberWithInt:countId] forKey:@"counterId"];
      [move setValue:[NSNumber numberWithInt:playerType] forKey:@"playerType"];
      [move setDelegate:self];
  
      // add move to the layer
      [layer addAnimation:move forKey:@"moveAnimation"];
  
  }
  </code></pre>
  
  <p>.. and then a delegate sets the layer position and removes the animation when its finished (otherwise the counter moves back to its start position). </p>
  
  <pre><code>-(void)animationDidStop:(CABasicAnimation *)anim finished:(BOOL)flag {
  
      NSNumber *counterId = [anim valueForKey:@"counterImageId"];
      NSNumber *playerId = [anim valueForKey:@"playerType"];
  
      int countId = [counterId intValue];
      int playId = [playerId intValue];
  
  // code here gets position information using counter and player id
  
      // set the final position of the layer when the anim stops, then remove the anim
      [layer setPosition:CGPointMake(xPos, yPos)];
      [layer removeAnimationForKey:@"moveAnimation"];
  
  }
  </code></pre>
  
  <p>This all works fine when one counter is moving, but when one counter takes another i use the same method to move both. I thought that a copy of the animation was passed to the layer and so i could call it to move the first counter layer, and then call it again straight after for it to move the second one. I log out the object ids and two different move anims are created, but only the second counter moves. animationDidStop: is called twice and the correct counter information is passed each time.</p>
  
  <p>Any ideas about how to make it work? I've trawled through quite a lot of CAAnimation/CALayer questions so i guess its not just me having trouble with it ;)</p>