SVG rounded corner

前端 未结 12 2096
谎友^
谎友^ 2020-11-28 22:21

I have the following SVG:



        
12条回答
  •  孤街浪徒
    2020-11-28 23:03

    Here is how you can create a rounded rectangle with SVG Path:

    
    

    Explanation

    m100,100: move to point(100,100)

    h200: draw a 200px horizontal line from where we are

    a20,20 0 0 1 20,20: draw an arc with 20px X radius, 20px Y radius, clockwise, to a point with 20px difference in X and Y axis

    v200: draw a 200px vertical line from where we are

    a20,20 0 0 1 -20,20: draw an arc with 20px X and Y radius, clockwise, to a point with -20px difference in X and 20px difference in Y axis

    h-200: draw a -200px horizontal line from where we are

    a20,20 0 0 1 -20,-20: draw an arc with 20px X and Y radius, clockwise, to a point with -20px difference in X and -20px difference in Y axis

    v-200: draw a -200px vertical line from where we are

    a20,20 0 0 1 20,-20: draw an arc with 20px X and Y radius, clockwise, to a point with 20px difference in X and -20px difference in Y axis

    z: close the path

    
      
    

提交回复
热议问题