2
我有一个SVG动画,我想用css设置animate
标签属性from
和to
。从css中设置svg animate的属性
喜欢:
animate{
from: #f7f7f7;
to: #33d424;
}
这是可能的,我该怎么办呢?
这里是我的SVG代码:
<svg width='100px' height='100px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-squares">
<rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
<rect x="15" y="15" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.0s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="40" y="15" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.125s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="65" y="15" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.25s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="15" y="40" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.875s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="65" y="40" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.375" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="15" y="65" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.75s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="40" y="65" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.625s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="65" y="65" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.5s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
</svg>
这是不可能的。动画属性不是CSS属性。 – 2015-04-03 07:24:51