2012-04-09 74 views
0

我有一层,我想修改它的大小。但是有些东西让我感到困惑。正在修改其transform属性,与在图层上制作基本动画相同。是这样的:iPhone关键路径的图层动画?

layer.transform = CATransform3DMakeScale(0.5, 0.5, 1); 

一样:

CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath: @"transform.scale"]; 
scale.fromValue = [NSNumber numberWithDouble:startScale]; 
scale.toValue = [NSNumber numberWithDouble:endScale]; 
[layer addAnimation:scale forKey:@"animateScale"]; 

另外,有一些名单,我可以看到什么keypaths可用于基本的动画?

回答

1

你可以找到它的头文件。它将被记录为动画。看看this答案。

1

是的,结果非常相似。

第一种方法使用CALayers的隐式动画功能。

使用CABasicAnimation会为您提供更多的控制和其他选项,但需要花费更多的设置。