練習30天SVG之基礎開篇ellipse標籤(part3)

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

結果:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值