如何沿路径制作动画

时间:2014-02-27 01:47:28

标签: objective-c

如何沿路径动画UIImageView?

有没有人知道任何介绍这个的教程?

1 个答案:

答案 0 :(得分:0)

CAKeyframeAnimation可以这样做。

CGMutablePathRef path = CGPathCreateMutable();
//your code to configure the path

//configure the animation
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
[animation setPath:path];
[animation setDuration:3.0];
CGPathRelease(path);
[self.yourImageView.layer addAnimation:animation forKey:NULL];