【发布时间】:2012-06-07 19:55:04
【问题描述】:
我想将矩形的 UIBezierPath 动画化为三角形,而不是动画路径上的视图,而是动画路径本身,使其从一种形状变形为另一种形状。路径被添加到一个CALayer
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];
}
【问题讨论】:
标签: objective-c animation calayer cgpath uibezierpath