可以使用纯 CSS 禁用 SVG SMIL 动画吗?

问题描述

我有一些 HTML 页面,其中包含使用 SMIL 动画的 SVG 元素。这是一个简化的例子:

<html>
 <body>
  <svg width="100" height="100">
   <circle cx="50" cy="50" r="20">
    <animate attributeName="r" repeatCount="indefinite" values="10;30;10" dur="2s"/>
   </circle>
  </svg>
 </body>
</html>

当 CSS prefers-reduced-motion 设置为 reduce 时,是否可以使用纯 CSS 来禁用动画?

@media (prefers-reduced-motion: reduce) {
 animate {
  /* is there anything I can put here that will disable the animation? */
  /* If there is,what would the circle's "r" attribute be set to when the animation is disabled? */
 }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)