私人资料库
本博客大部分技术文章,均从网络搜索得来,旨在收集整理技术资料,文章版权归属原作者,由此引起的任何版权问题,与本人无关。

转自:http://blog.sina.com.cn/s/blog_53e2ac4d0100qoke.html

 

CABasicAnimation animationWithKeyPath Types

When using the ‘CABasicAnimation’ from the QuartzCore Framework in Objective-C, you have to specify an animationWithKeyPath.  This is a long string and is not easily listed in the CABasicAnimation, CAPropertyAnimation, or the CAAnimation class.  I ended up finding a handy chart within the Core Animation Programming guide in Apple’s iPhone OS Reference Library.  Hope this helps save someone time, at least it will for me.

animationWithKeyPath types


01.//The following code moves a view up 60 pixels and stops.
02. 
03.CABasicAnimation *theAnimation;
04.theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
05.theAnimation.delegate = self;
06.theAnimation.duration = 1;
07.theAnimation.repeatCount = 0;
08.theAnimation.removedOnCompletion = FALSE;
09.theAnimation.fillMode = kCAFillModeForwards;
10.theAnimation.autoreverses = NO;
11.theAnimation.fromValue = [NSNumber numberWithFloat:0];
12.theAnimation.toValue = [NSNumber numberWithFloat:-60];
13. 

14.[self.view.layer addAnimation:theAnimation forKey:@"animateLayer"]; 

posted on 2011-07-20 10:57  该显示名称已被其他用户使用  阅读(403)  评论(0编辑  收藏  举报