【发布时间】:2015-08-28 07:01:06
【问题描述】:
我有一个 UIImageView,它使用以下代码从正方形动画到圆形:
CABasicAnimation *circleShapeAnimation = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
circleShapeAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
circleShapeAnimation.toValue = [NSNumber numberWithFloat:cornerRadius];
我还有一个单独的 UIView(它的 backgroundColor 是 clearColor),我专门用它来实现动画阴影。一切都很好,除了形状动画:
CABasicAnimation* shadowShapeAnimation = [CABasicAnimation animationWithKeyPath: @"shadowPath"];
shadowShapeAnimation.fromValue = (id)[UIBezierPath bezierPathWithRoundedRect: cell.placeImage.bounds cornerRadius:0.0f].CGPath;
shadowShapeAnimation.toValue = (id)[UIBezierPath bezierPathWithRoundedRect: cell.placeImage.bounds cornerRadius:cornerRadius].CGPath;
简单地说,比我早上宿醉的样子更丑。
我想实现一个漂亮、流畅的圆角动画。知道怎么做吗?
【问题讨论】:
标签: ios objective-c core-animation uibezierpath caanimation