SVG <circle>元素

<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 圓的半徑。

示例

檔:textSVG.html -

<html>
   <title>SVG圓形</title>
   <body>

      <h1>簡單SVG圓形圖片</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.html。 可以使用Chrome/Firefox/Opera直接查看SVG圖像,無需任何插件。 Internet Explorer 9及更高版本還支持SVG圖像呈現。

示例:用不透明的圓圈

<html>
   <title>SVG圓形</title>
   <body>

      <h1>簡單SVG圓形圖片</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.html。 可以使用Chrome/Firefox/Opera直接查看SVG圖像,無需任何插件。 Internet Explorer 9及更高版本還支持SVG圖像呈現。


上一篇: SVG形狀 下一篇: SVG文本