title: How to Animate a UIBezierPath
body: <p>i would like to animate a UIBezierPath of a rect to a triangle one, not to animate a view on a path but animate the path itself so it morphs from one shape to another. the path is added to a CALayer</p>
  
  <pre><code>CAShapeLayer *maskLayer = [CAShapeLayer layer];
  maskLayer.fillColor = [[UIColor whiteColor] CGColor];    
  maskLayer.path = [self getRectPath];
  
  -(CGPathRef)getTrianglePath
  {
      UIBezierPath* triangle = [UIBezierPath bezierPath];
      [triangle moveToPoint:CGPointZero];
      [triangle addLineToPoint:CGPointMake(width(self.view),0)];
      [triangle addLineToPoint:CGPointMake(0, height(self.view))];
      [triangle closePath];
      return [triangle CGPath];
  }
  
  -(CGPathRef)getRectPath
  {
      UIBezierPath*rect = [UIBezierPath bezierPathWithRect:self.view.frame];
      return [rect CGPath];
  }
  </code></pre>