アニメーションは制限なく停止して繰り返すことができますが、無期限のアニメーションを再開すると、累積値が失われ、初期値から開始されます。
例で明確にする必要があるかもしれません。このアニメーションを見てください:
<animate id="main"
attributeName="transform" attributeType="XML"
begin="startbox.click" dur="1s" end="endbox.click"
from="rotate(0)" to="rotate(360)"
additive="sum"
accumulate="sum"
fill="freeze"
repeatCount="indefinite"
/>
このアニメーションを停止しid="second"
、同じオブジェクトの回転に影響を与える別のアニメーション (たとえば ) を開始すると、中断しsecond
たポイントから完全に継続main
します。しかし、これをクリックしてstartbox
(または実際には他のイベントで)開始するmain
と、開始前にすべての差が差し引かれ、回転がリセットされます。
私がしたいのは、アニメーションが以前に停止した場所から続行できる適切な「一時停止」です。もちろん、一定数の同じアニメーションと同じ数の同じ開始/停止ボタンを追加して効果をエミュレートすることもできますが、それは適切な解決策ではありません。特にポーズの数が限られているので。
全体の例 (Opera でのみ動作するようです)
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
xmlns="http://www.w3.org/2000/svg" version="1.1"
xmlns:xlink="http://www.w3.org/1999/xlink">
<desc>Click example</desc>
<g>
<rect id="startbox"
x="10" y="10"
width="20" height="20"
stroke="none" fill="green"
/>
<rect id="endbox"
x="10" y="40"
width="20" height="20"
stroke="none" fill="red"
/>
<g transform="translate(200,200)">
<rect
x="0" y="0"
width="50" height="5"
stroke="#10e9f3" fill="#30ffd0"
>
<animate
attributeName="transform" attributeType="XML"
begin="startbox.click" dur="1s" end="endbox.click"
from="rotate(0)" to="rotate(360)"
additive="sum"
accumulate="sum"
fill="freeze"
repeatCount="indefinite"
/>
</rect>
</g>
</g>
</svg>