<ellipse> 标签
定義:可用来创建椭圆。椭圆与圆很相似。不同之处在于椭圆有不同的 x 和 y 半径,而圆的 x 和 y 半径是相同的。
栗子:
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="210" cy="100" rx="150" ry="100" style="fill:rgba(200,100,50,.7);
stroke:rgba(0,255,255,.8);stroke-width:2" />
<text x="210" y="125" font-size="60" text-anchor="middle" fill="white">SVG</text>
</svg>
結果:
代码解释:
- cx 属性定义圆点的 x 坐标
- cy 属性定义圆点的 y 坐标
- rx 属性定义水平半径
- ry 属性定义垂直半径
栗子二:
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="240" cy="100" rx="220" ry="30" style="fill:purple;transform:skew(35deg) scale(2) translate(18px);opacity: 0.7;stroke-width:5;stroke:rgba(255,0,0,.8)" />
<ellipse cx="220" cy="70" rx="190" ry="20" style="fill:lime;transform:skew(40deg) scale(1.8) translate(20px);opacity: 0.7;stroke-width:5;stroke:rgba(255,0,0,.8) "/>
<ellipse cx="210" cy="45" rx="170" ry="15" style="fill:yellow;transform:skew(45deg) scale(1.6) translate(22px);opacity: 0.7; stroke-width:5;stroke:rgba(255,0,0,.8)"/>
</svg>
結果:
栗子三:
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="240" cy="100" rx="220" ry="60" style="fill:pink;stroke-width:5;stroke:rgba(255,0,0,.8)" />
<ellipse cx="220" cy="100" rx="190" ry="50" style="fill:lime;stroke-width:5;stroke:rgba(255,0,0,.8)" />
</svg>
結果: