animate

<animate>

The animate element is put inside a shape element and defines how an attribute of an element changes over the animation. The attribute will change from the initial value to the end value in the duration specified.

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" viewPort="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

Specifications

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

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 2.0 4.0 (2.0) No support 9.0 4.0
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? 4.0 (2.0) No support 9.5 4.0

The chart is based on these sources.

© 2005–2017 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

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部