svg圆形的缩放
1创建动画 ,告诉动画标记那个元素需要执行动画
2创建元素。在元素中说明需要执行什么动画
<svg width="500" height="500">
<circle cx="100" cy="100" r="0">
<animate attributeName="r" attributeType="XML" from="50" to="100" dur="3" fill="freeze"></animate>
</circle>
r是圆的半径 animate是开始动画 attributeName="r" 是开始移动的是半径
from="50" to="100" 是在半径为50 放大到100 dur是放大的秒数
<circle cx="100" cy="100" r="0">
<animate attributeName="r" attributeType="XML" from="50" to="100" dur="3" fill="freeze"></animate>
<animate attributeName="fill" attributeType="XML" from="red" to="green" dur="3" fill="freeze"></animate>
</circle>
fill是circle 里的填充属性以上没有填充所以是黑色
attributeName="fill" 是改变填充色 from="red" to="green" dur="3" 同理 这个是在红色到绿色
过程的时间是3S
<svg width="500" height="500">
<circle cx="100" cy="100" r="0">
<animate attributeName="r" attributeType="XML" from="50" to="100" dur="3" fill="freeze"></animate>
<animate attributeName="fill" attributeType="XML" from="red" to="green" dur="3" fill="freeze"></animate>
<animate attributeName="cx" attributeType="XML" from="100" to="400" dur="3" fill="freeze"></animate>
</circle>
所以attributeName="cx" 是移动圆的 x 方向 (cy 就可以移动y的反向 ) from="100" to="400" dur="3" 是x 100 移动到 x 400的位置 时间3s 加入 repeatCount="indefinite"属性可以重复无限次动作 加入数字就是多少次
旋转
<svg width="500" height="500">
<rect x="150" y="150" width="20" height="200" fill="" stroke="green" stroke-width="5" >
<animateTransform attributeName="transform" type="rotate" from="0 160 250"
to="360 160 250" dur="1" repeatCount="indefinite">
</animateTransform>
</rect>
</svg>
是一个矩形研中心点旋转旋转 首先找到矩形的中心点 这是最难的 ,
from="0 160 250" 第一个值是角度0开始 160 250是中心点
to="360 160 250" 旋转到360° 160 250是中心点
dur="1" 是在1S时间
repeatCount="indefinite" 无线次