0

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?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
MegaManX
  • 8,766
  • 12
  • 51
  • 83

2 Answers2

1

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

Community
  • 1
  • 1
Vignesh
  • 10,205
  • 2
  • 35
  • 73
1

Yes, the results are very similar.

The first approach uses the implicit animation feature of CALayers.

Using a CABasicAnimation gives you a lot more control and other options, at the cost of more setup.

Duncan C
  • 128,072
  • 22
  • 173
  • 272