CALayer在动画中移动了几次

时间:2013-04-09 19:32:26

标签: objective-c animation calayer

现在我有了动画 - 将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在一个动画中从一个点移动到另一个点时,如何创建动画?

0 个答案:

没有答案