title: Animate view - Spin, shrink and move off screen
body: <p>I have a custom UIView class that I want to spin, shrink and move off screen at a random angle all at the same time.</p>
  
  <p>I have this code that will spin the layer a few times </p>
  
  <pre><code>- (void)spinLayer:(CALayer *)inLayer duration:(CFTimeInterval)inDuration currentAngle:(CGFloat)curAngle
          direction:(int)direction
  {
      CABasicAnimation* rotationAnimation;
  
      // Rotate about the z axis
      rotationAnimation = 
      [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
  
      // Rotate 360 degress, in direction specified
      rotationAnimation.toValue = [NSNumber numberWithFloat:(M_PI * 4 * direction) + curAngle];
  
      // Perform the rotation over this many seconds
      rotationAnimation.duration = inDuration;
  
      // Set the pacing of the animation
      rotationAnimation.timingFunction = 
      [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
  
      // Add animation to the layer and make it so
      [inLayer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
  }
  </code></pre>
  
  <p>which I call like this:</p>
  
  <pre><code>CGFloat angle = atan2(sender.transform.b, sender.transform.a);  // Current angle
  [self spinLayer:sender.layer duration:0.5 currentAngle:angle direction:1]; //direction can be -1
  </code></pre>
  
  <p>But how can I now shrink the view and move it at the same time?</p>
  
  <p>Thanks</p>