zoukankan      html  css  js  c++  java
  • UIBezierPath 贝塞尔曲线

    1.

        UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(3030100100) cornerRadius:0];

        CAShapeLayer * layer = [CAShapeLayer layer];
        layer.path = path.CGPath;
        layer.fillColor = [[UIColor blackColor]CGColor];

        layer.strokeColor = [[UIColor orangeColor] CGColor];    

        [self.view.layer addSublayer:layer];

      从下图可以看出,这个layer是一个矩形,那是因为 cornerRadius赋值为0

    本文转自 张江论坛  张江家园网  http://www.999dh.net/home.php?mod=space&uid=1&do=blog&id=370  转载请注明  

    2.UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(3030100100) cornerRadius:0];修改为

       UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(3030100100) cornerRadius:30];后,得到的结果是

      

    还可以通过

    layer.lineCap = kCALineCapRound;
    layer.lineWidth = 3.0f;
    来指定stroke的宽度以及各式。

    3 .[UIBezierPath bezierPathWithArcCenter:CGPointMake(100100) radius:50 startAngle:0 endAngle:2*3.14159 clockwise:YES];
        是以 100,100为中心点,以50为半径,的一个圆(角度从0到2*PI)  clockwise表示顺时针。

    4.UIBezierPath * path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(100100) radius:50 startAngle:0 endAngle:3.14159 clockwise:NO];

        CAShapeLayer * layer = [CAShapeLayer layer];

        layer.path = path.CGPath;

        layer.fillColor = [[UIColor blackColor]CGColor];

        layer.strokeColor = [[UIColor orangeColor] CGColor];

        layer.lineCap = kCALineCapRound;

        layer.lineWidth = 3.0f;

        [self.view.layer addSublayer:layer];

     

      运行入下图
      UIBezierPath * path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(100100) radius:50 startAngle:0 endAngle:3.14159 clockwise:NO];

       从0到一个PI,方向是逆时针,所以就是上半个圆形。

       

  • 相关阅读:
    Vue-router(5)之 路由的before家族
    Vue-router(4)之路由跳转
    Vue-router(3)之 router-link 和 router-view 使用
    Vue-router(1)之component标签
    Vue.js(4)- 生命周期
    Vue.js 之 过渡动画
    Vue.js(2)- 过滤器
    函数节流和函数防抖
    认识与学习 BASH
    linux下创建文件与目录时默认被赋予了什么样的权限?
  • 原文地址:https://www.cnblogs.com/rollrock/p/3844768.html
Copyright © 2011-2022 走看看