This element is an addition to the SMIL standard to allow you to animate an object along a path.
Code 3. Example of the 'animateMotion' animation element.
This element is included for compatibility with the SMIL standard. It is identical to the 'animate' element except that the 'to', 'from' and 'by' attributes must be colors.
Since the other animation elements only animate a single attribute, a different way to animate transformations is required. To animate a transformation you use the animateTransform element which adds a 'type' attribute so that you can specify what type of transformation you are animating.
Note: You still need to specify the 'attributeName' attribute with this element or no animation occurs.
Example 4. Click the green box to animate the snowflake.
(Download)
<animateTransform begin="startButton.click" attributeName="transform"
type="translate" from="10,10" to="140,180" dur="5s"
additive="sum" fill="freeze" xlink:href="#snow" />
<animateTransform begin="startButton.click" attributeName="transform"
type="rotate" from="0" to="270" dur="5s"
additive="sum" fill="freeze" xlink:href="#snow" />
Code 4. Example of the 'animateTransform' animation element.
The above example uses the attribute 'additive' with the value 'sum' so the second animation doesn't replace the first. The default value of 'replace' would result in the 2nd animation overwriting changes made to the 'transform' attribute by the 1rst animation.
Offset Timing
<set begin="ani1.click+2.0s" attributeName="fill" to="yellow" />
Code 5. Example of offset timing.
The second way to animate in SVG is using the built in scripting language, ECMAScript (Javascript), and doing the animation by using a timer and directly changing the values. The animated 3D cube works by computing new values for the polygons each time the timer fires.