2017-08-10 13 views
0

円の動きの2秒後に長方形を動かしたいと思います。私は各アニメーションにIDを与えてから、beginイベント参照でIDを使用します。しかし、何も動作していないようです。SVGアニメーションをどのように同期できますか?

<svg width="800" height="600" style="background-color:black"> 

<circle id="circle" cx="30" cy="100" r="20" fill="gold" /> 

<animate 
xlink:href="#circle" 
attributeName="cx" 
from="30" 
to="750" 
dur="4s" 
repeatCount="indefinite" 
id="circ-anim" /> 

<rect id="rectangle" x="50" y="400" width="50" height="20" fill="gold" /> 

<animate 
xlink:href="#rectangle" 
attributeName="x" 
dur="3s" 
from="50" 
to="450 
begin="circ-anim.begin + 2s" 
id="rect-anim" /> 

</svg> 
+1

あなたは他のすべての属性が赤くている間 'begin'が青であるかを確認?そして、このタイプミスが修正されたら、FFを使用している場合は、 '#circ-anim'を'#circ_anim'に変更してみてください。私は ''は本当にIDで楽しんでいないことを覚えていると思います。 – Kaiido

+1

あなたは '' 'to =" 450' – Kaiido

+0

の後に忘れてしまった@Kaiido thanxたくさん、すべてが今完璧です) – CeeJay

答えて

0

詳細情報here。別の始点を追加することもできます。私はCeeJayのようなスニペットにすべてを入れました。

<svg width="800" height="600" style="background-color:black"> 
 

 
<circle id="circle" cx="30" cy="100" r="20" fill="gold" /> 
 

 
<animate 
 
xlink:href="#circle" 
 
attributeName="cx" 
 
from="30" 
 
to="750" 
 
dur="4s" 
 
repeatCount="indefinite" 
 
id="circanim" /> 
 

 
<rect id="rectangle" x="50" y="400" width="50" height="20" fill="gold" /> 
 

 
<animate 
 
xlink:href="#rectangle" 
 
attributeName="x" 
 
dur="3s" 
 
from="50" 
 
to="450" 
 
begin="circanim.begin+2s" 
 
id="rectanim" 
 
repeatCount="indefinite"/> 
 

 
</svg>

関連する問題