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文本