title: Getting the scale factor from a CABasicAnimation
body: <p>I'm animating a shrinking object. At any point the user can hit a button to get the current scale factor of the object. (I start by scaling the object up using a CGAffineTransformMakeScale, so the scale factor should be 1 when it reaches its original size). I'm just not sure how to retrieve the current scale factor from the animation UIImageView... Here's my code:</p>
  
  <pre><code>- (void)startShrink {
      CGAffineTransform scaleFactor = CGAffineTransformMakeScale(kScaleX, kScaleY);
      imageOutline.transform = scaleFactor;
  
      CABasicAnimation *shrink = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
      shrink.toValue = [NSNumber numberWithDouble:0.5];
      shrink.duration = 2.0;
      shrink.fillMode=kCAFillModeForwards;
      shrink.removedOnCompletion=NO;
      shrink.delegate = self;
  
      [imageOutline.layer addAnimation:shrink forKey:@"shrink"];
  }
  </code></pre>
  
  <p>I tried the following, but I'm not sure m12 is the value I should be retrieving from the transform. Or if in fact this is the right approach:</p>
  
  <pre><code>- (float)calculateScale {
      CATransform3D scaleTransform = [(CALayer *)[imageOutline.layer presentationLayer] transform];
      float scale = scaleTransform.m12;
      NSLog(@"Scale: %g", scale);
      return scale;
  }
  </code></pre>
  
  <p>Any advice most appreciated :) </p>
  
  <p>Thanks, Michael. </p>