Apply animateColor to multiple SVG elements
Is there any way to define a color animation for multiple elements at once? I tried adding the animateColor
to a g
element, but that didn't work. I could use Javascript to add an animateColor
to each element individually, but I'd prefer to do it all in the static SVG data.开发者_Go百科
Please use animate
instead of animateColor
. Firefox, at least, doesn't implement animateColor
at the moment and it is being deprecated in SVG 1.1 Second Edition. Using animate
for animating fill and stroke works just fine. For example:
<g>
<animate attributeName="fill" from="black" to="red" dur="5s"/>
<rect width="100" height="100"/>
<circle cx="200" cy="50" r="50"/>
</g>
精彩评论