现在我有动画 - 将 calayer 从实际点移动到其他点,一步:
CGPoint startPt = CGPointMake(self.firstBall.ballCoordinates.x,self.firstBall.ballCoordinates.y);
CGPoint endPt = CGPointMake(self.secondBall.ballCoordinates.x,self.secondBall.ballCoordinates.y);
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"position"];
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim.fromValue = [NSValue valueWithCGPoint:startPt];
anim.toValue = [NSValue valueWithCGPoint:endPt];
anim.repeatCount = 0;
anim.duration = 1.0;
[self.firstBall.ballLayer addAnimation:anim forKey:@"position"];
当我的 calayer 在一个动画中从一个点移动到另一个点时,如何创建动画?