<animate>

The SVG <animate> element provides a way to animate an attribute of an element over time.

范例

<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
  <rect width="10" height="10">
    <animate attributeName="rx" values="0;5;0" dur="10s" repeatCount="indefinite" />
  </rect>
</svg>

					

属性

Animation Attributes

Animation timing attributes
begin , dur , end , min , max , restart , repeatCount , repeatDur , fill
Animation value attributes
calcMode , values , keyTimes , keySplines , from , to , by
Other Animation attributes

Most notably: attributeName , additive , accumulate

Animation event attributes

Most notably: onbegin , onend , onrepeat

全局属性

Core Attributes

Most notably: id

Styling Attributes
class , style
Event Attributes

Global event attributes , Document element event attributes

用法注意事项

This element implements the SVGAnimateElement 接口。

可访问性关注

Blinking and flashing animation can be problematic for people with cognitive concerns such as Attention Deficit Hyperactivity Disorder (ADHD). Additionally, certain kinds of motion can be a trigger for Vestibular disorders, epilepsy, and migraine and Scotopic sensitivity.

Consider providing a mechanism for pausing or disabling animation, as well as using the Reduced Motion Media Query to create a complimentary experience for users who have expressed a preference for no animated experiences.

规范

规范
SVG Animations Level 2 (SVG Animations 2)
# AnimateElement

浏览器兼容性

BCD tables only load in the browser

Found a problem with this page?

最后修改: , 由 MDN 贡献者