W3cubDocs

/SVG

<animate>

The 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.

Usage context

Categories Animation element
Permitted content Any number of the following elements, in any order:
Descriptive elements

Attributes

Global attributes

Specific attributes

DOM Interface

This element implements the SVGAnimateElement interface.

Example

SVG

<?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>

Result

Accessibility concerns

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.

Specifications

Browser compatibilityUpdate compatibility data on GitHub

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