【发布时间】:2011-07-15 14:39:01
【问题描述】:
我想使用 animateTransform 连续旋转 SVG 图像。所以我们开始:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="1024px" height="768px" enable-background="new 0 0 100 100" xml:space="preserve">
<g transform="translate(100, 100)">
<rect fill="#FE9FFF" width="100px" height="100px">
<animateTransform attributeName="transform" type="rotate"
from="0" to="360" dur="20s" repeatDur="indefinite"/>
</rect>
</g>
</svg>
这行得通。
现在:我想更改上面的内容,使块围绕其中心而不是左上角旋转。我知道如果我想围绕它的中心静态旋转块,我可以这样做:
<g transform="rotate(30, 50, 50)">
<rect fill="#FE9FFF" width="100px" height="100px">
</rect>
</g>
我的问题是 - 我如何管理围绕块中心的连续动画旋转?我查看了 SO 上的 spec 和几个 other related questions,但我在执行所提供的解释时遇到了麻烦。
提前致谢。
【问题讨论】:
标签: animation svg rotation transform