animate
SVG element is used to animate an attribute or property of an element over time. It's normally inserted inside the element or referenced by the href
attribute of the target element. Categories | Animation element |
---|---|
Permitted content | Any number of the following elements, in any order: Descriptive elements |
externalResourcesRequired
This element implements the SVGAnimateElement
interface.
<?xml version="1.0"?> <svg width="120" height="120" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributeType="XML" attributeName="x" from="-100" to="120" dur="10s" repeatCount="indefinite"/> </rect> </svg>
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.
Specification | Status | Comment |
---|---|---|
SVG Animations Level 2 The definition of '<animate>' in that specification. | Editor's Draft | No change |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) The definition of '<animate>' in that specification. | Recommendation | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 2 | ? | 4 | No | 9 | 4 |
attributeName |
? | ? | ? | ? | ? | ? |
attributeType |
? | ? | ? | ? | ? | ? |
to |
? | ? | ? | ? | ? | ? |
from |
? | ? | ? | ? | ? | ? |
dur |
? | ? | ? | ? | ? | ? |
repeatCount |
? | ? | ? | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | 18 | ? | 4 | 9.5 | 4 | ? |
attributeName |
? | ? | ? | ? | ? | ? | ? |
attributeType |
? | ? | ? | ? | ? | ? | ? |
to |
? | ? | ? | ? | ? | ? | ? |
from |
? | ? | ? | ? | ? | ? | ? |
dur |
? | ? | ? | ? | ? | ? | ? |
repeatCount |
? | ? | ? | ? | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/animate