2012-10-29 23 views
2

我想在SVG動畫元素中恰好切換兩個值。我試着這樣說:在SVG動畫元素中切換2個值

<?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 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="150" height="150" viewBox="0 0 150 150"> 

    <rect x="10" y="10" width="100" height="100" fill="blue" stroke="red"> 
     <animate attributeName="fill-opacity" values="0; 1" dur="1s" repeatCount="indefinite"/> 
    </rect> 
</svg> 

我想有填充不透明度值0和1,但它的作用是褪色之間切換從0到1,我希望它留在0 1秒,然後在1上停留1秒,在1秒後停留在0上等等。

我該怎麼做?我嘗試了幾乎所有可能的屬性組合,但沒有管理它。

回答

0

你想要calcMode =「離散」的animate元素的默認線性。

+0

就是這樣!謝謝你。我不知道爲什麼我沒有嘗試'calcMode'屬性。 – radlan