Search code examples
iphonecore-animationcalayer

iPhone keypaths for layer animations?


I have a layer and i would like to modify its size. But there is something that bugs me. Is modifying its transform property, same as making basic animation on layer. Is this:

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

same as:

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

Also, is there some list where I can see what keypaths are available for basic animations?


Solution

  • You can find it header file . It will be noted as Animatable. Have a look at this answer.