zoukankan      html  css  js  c++  java
  • iOS 画圆

        _demoView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
        [self.view addSubview:_demoView];
        
        CAShapeLayer *shapeLayer = [CAShapeLayer layer];
        shapeLayer.frame = _demoView.bounds;
        UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:_demoView.bounds];
        shapeLayer.path = path.CGPath;
    //    shapeLayer.strokeEnd = 1.0f;
    //    shapeLayer.strokeStart = 0.75f;
        shapeLayer.fillColor = [UIColor clearColor].CGColor;
        shapeLayer.lineWidth = 2.0f;
        shapeLayer.strokeColor = [UIColor redColor].CGColor;
        [_demoView.layer addSublayer:shapeLayer];
        CABasicAnimation *pathAnima = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
        pathAnima.duration = 3.0f;
        pathAnima.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
        pathAnima.fromValue = [NSNumber numberWithFloat:0.0f];
        pathAnima.toValue = [NSNumber numberWithFloat:1.0f];
        pathAnima.fillMode = kCAFillModeForwards;
        pathAnima.removedOnCompletion = NO;
        [shapeLayer addAnimation:pathAnima forKey:@"strokeEndAnimation"];
    
  • 相关阅读:
    Arraw function
    constructor&object 的联系与对比
    for each in&for in&for of
    编程历史
    正则表达式
    DOM&BOM
    关于码云0095的一篇文章。
    vue2路由导航守卫(钩子函数)
    原声ajax请求数据
    express 创建项目
  • 原文地址:https://www.cnblogs.com/Milo-CTO/p/7889769.html
Copyright © 2011-2022 走看看