SVG动画.animateTransform

1、来自于:SVG之Animation - 前端学习笔记 - SegmentFault.html(https://segmentfault.com/a/1190000009371194

2、AnimateTransform.html(UTF8)

  ZC:下面的属性(type="scale" from="1" to="4 2"),实际等价于(type="scale" from="1 1" to="4 2") ∵scale是2个参数,(from="1")是省略了一个参数。

  ZC:同样(type="rotate" from="0" to="45") 也是省略了参数,但是 在写 图形的属性的时候 rotate是以 SVG的(0,0)坐标为中心的,这里 同样是这样的...(可以观察第二个矩形的变化)

  2.1、测试代码

<!DOCTYPE html>

<html>
<head>
    <meta charset="UTF-8">
</head>

<body>

    <svg width="800" height="600" viewBox="-400 -300 800 600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
        <!--矩形中心 == SVG的(0,0)点-->
        <rect x="-10" y="-10" width="20" height="20" style="fill: #ff9; stroke: black;">
            <animateTransform id="a1" attributeName="transform" attributeType="XML" type="scale" from="1" to="4 2" additive="sum" begin="0s" dur="4s" fill="freeze"></animateTransform>
            <animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0" to="45" additive="sum" begin="a1.end" dur="4s" fill="freeze"></animateTransform>
        </rect>

        <!--矩形中心 != SVG的(0,0)点-->
        <rect x="20" y="20" width="20" height="20" style="fill: #ff9; stroke: black;">
            <animateTransform id="a1" attributeName="transform" attributeType="XML" type="scale" from="1" to="4 2" additive="sum" begin="0s" dur="4s" fill="freeze"></animateTransform>
            <animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0" to="45" additive="sum" begin="a1.end" dur="4s" fill="freeze"></animateTransform>
        </rect>
    </svg>

</body>
</html>

 

3、

4、

5、

 

转载于:https://www.cnblogs.com/H5UI/p/8405789.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值