SVG - 圓形



<circle> 元素用於繪製以中心點和給定半徑為引數的圓形。

宣告

以下是<circle>元素的語法宣告。我們只展示了主要屬性。

<circle
   cx="x-axis co-ordinate"
   cy="y-axis co-ordinate"
   r="length" >   
</circle>

屬性

序號 名稱及描述
1 cx − 圓心在 x 軸上的座標。預設為 0。
2 cy − 圓心在 y 軸上的座標。預設為 0。
3 r − 圓的半徑。

示例

testSVG.htm
<html>
   <title>SVG Circle</title>
   <body>
      
      <h1>Sample SVG Circle Image</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="0" y="15" fill="black" >Circle #1: Without opacity.</text>
            <circle cx="100" cy="100" r="50" stroke="black" 
            stroke-width="3" fill="rgb(121,0,121)"></circle>
         </g> 
      </svg>
      
   </body>
</html>

輸出

在 Chrome 瀏覽器中開啟 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接檢視 SVG 影像,無需任何外掛。Internet Explorer 9 及更高版本也支援 SVG 影像渲染。

具有透明度的圓形

<html>
   <title>SVG Circle</title>
   <body>
   
      <h1>Sample SVG Circle Image</h1>
      
      <svg width="800" height="800"> 
         <g>
            <text x="0" y="15" fill="black" >Circle #2: With opacity </text>
            <circle cx="100" cy="100" r="50"
            style="fill:rgb(121,0,121);stroke-width:3;
            stroke:rgb(0,0,0);stroke-opacity:0.5;opacity:0.5"> </circle>
         </g>
      </svg>
   
   </body>
</html>

輸出

在 Chrome 瀏覽器中開啟 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接檢視 SVG 影像,無需任何外掛。Internet Explorer 9 及更高版本也支援 SVG 影像渲染。

svg_shapes.htm
廣告

© . All rights reserved.