本文介绍了应用animateColor多个SVG元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以一次定义多个元素彩色动画?我试着加入 animateColor 先按g 元素,但没有奏效。我可以使用JavaScript来一个<$ C C> animateColor 添加到每个单独的元素,但我preFER做这一切在静态的SVG数据。

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.

推荐答案

请使用动画而不是 animateColor 的。火狐,至少,不实施 animateColor 目前,它正在在SVG 1.1第二版pcated德$ P $。使用动画的动画填充和中风的作品就好。例如:

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>

这篇关于应用animateColor多个SVG元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 23:59