SVG - 椭圆



<ellipse> 元素用于绘制椭圆,使用中心点和两个半径。

声明

以下是<ellipse>元素的语法声明。我们只显示了主要属性。

<ellipse
   cx="x-axis co-ordinate"
   cy="y-axis co-ordinate"
   
   rx="length" 
   ry="length" >    
</ellipse>

属性

序号 名称和描述
1 cx − 椭圆中心的 x 坐标。默认为 0。
2 cy − 椭圆中心的 y 坐标。默认为 0。
3 rx − 椭圆的 x 轴半径。
4 ry − 椭圆的 y 轴半径。

示例

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

输出

在 Chrome 浏览器中打开 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接查看 SVG 图片,无需任何插件。Internet Explorer 9 及更高版本也支持 SVG 图片渲染。

具有透明度的椭圆

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

输出

在 Chrome 浏览器中打开 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接查看 SVG 图片,无需任何插件。Internet Explorer 9 及更高版本也支持 SVG 图片渲染。

svg_shapes.htm
广告
© . All rights reserved.