SVG图像动画化

4
我可以将SVG圆形动画化吗?
<svg>
    <circle id="orange-circle" r="30" cx="50" cy="50" fill="orange" />
    <animate 
        xlink:href="#orange-circle"
        attributeName="cx"
        from="50"
        to="450" 
        dur="1s"
        fill="freeze"
        repeatCount="indefinite" />
</svg>

同样地,我正在尝试给一张图片添加动画效果:
<svg>
    <image id="orange-circle" x="0" y="20" width="200" height="180"  xlink:href="cat.png" /> 
    <animate 
        xlink:href="#orange-circle"
        attributeName="cx"
        from="50"
        to="450" 
        dur="1s"
        fill="freeze"
        repeatCount="indefinite" />
</svg>

我该如何使上面的代码运行起来?

实际问题是什么?动画没有开始吗?它们到底有什么问题?周围的代码是否可能起到作用? - dakab
看一个常见问题解答动画:https://css-tricks.com/transforms-on-svg-elements/ - KingRider
1个回答

4

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接