您的位置:首页 > 移动开发 > IOS开发

CABasicAnimation animationWithKeyPath 一些规定的值

2016-08-03 18:03 369 查看


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.








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"
];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS 动画