- (void)drawError
{
[_logoView removeFromSuperview];
_logoView = [[UIView alloc] initWithFrame:CGRectMake(([self getSelfSize].width-Simble_SIZE)/2, Simble_TOP, Simble_SIZE, Simble_SIZE)];
// 绘制轨迹 with UIBezierPath
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(Simble_SIZE/2, Simble_SIZE/2) radius:Simble_SIZE/2 startAngle:0 endAngle:M_PI*2 clockwise:YES];
CGPoint p1 = CGPointMake(Simble_SIZE/4, Simble_SIZE/4);
[path moveToPoint:p1];
CGPoint p2 = CGPointMake(Simble_SIZE/4*3, Simble_SIZE/4*3);
[path addLineToPoint:p2];
CGPoint p3 = CGPointMake(Simble_SIZE/4*3, Simble_SIZE/4);
[path moveToPoint:p3];
CGPoint p4 = CGPointMake(Simble_SIZE/4, Simble_SIZE/4*3);
[path addLineToPoint:p4];
CAShapeLayer *layer = [[CAShapeLayer alloc] init];
layer.lineWidth = 5;
layer.path = path.CGPath;
layer.fillColor = [UIColor clearColor].CGColor;
layer.strokeColor = [UIColor redColor].CGColor;
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:NSStringFromSelector(@selector(strokeEnd))];
animation.fromValue = @0;
animation.toValue = @1;
animation.duration = 0.5;
[layer addAnimation:animation forKey:NSStringFromSelector(@selector(strokeEnd))];
[_logoView.layer addSublayer:layer];
[self addSubview:_logoView];
}
iOS简单的动画绘制 #CABasicAnimation# #UIBezierPath#
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
相关阅读更多精彩内容
- iOS 简单的使用UIBezierPath绘制 UIBezierPath这个类呢主要用于绘图。 之前的项目中需要绘...
- 项目告一段落。闲下来自己看看了贝塞尔进行图形绘制,项目中没有过太多,但是看一个技术群讨论过绘图,自己在网上看了许多...
- 这篇文章介绍UIBezierPath的详细的使用, 以及一些细节! 创建一个XTBezierPath继承于UIVi...
- 之前一直抱着一种不很好的态度去写代码,不求甚解,不会就google,现在感觉长期这样是不行的,必须自己也依靠实践经...
- 独立CGPath总结 与CGContext关联的Path总结 点&线 注意 AddLineToPoint实现方式在...