views:

10

answers:

0

Hello,

I have just started working with Core Animation and I have an animation which moves an image from top to bottom.

theAnimation=[CABasicAnimation animationWithKeyPath:@"position"];
theAnimation.duration=5;
theAnimation.repeatCount=1;
theAnimation.autoreverses=NO;
theAnimation.removedOnCompletion=YES;
theAnimation.fromValue=[NSValue valueWithCGPoint:CGPointMake(0,0 )];
theAnimation.toValue=[NSValue valueWithCGPoint:CGPointMake(0, 460)];
[self.layer addAnimation:theAnimation forKey:@"animateLayer"];

This works fine. Now I want to control / manipulate the x-axis with the value of the Accelerometer. What is the best approach to do that? Remove the old animation and add a new one everytime the Accelerometer updated its values leads to a very slow animation. So it doesn't seem to be the right way.

I appreciate your efforts. thanks.

Sascha