With the <animateMotion> element, you can
animate any SVG element on any path that can be expressed
in SVG, which leaves enormous scope for creativity.
Code Example
SVG Image
<?xml version="1.0"
standalone="no"?>
Right-click
on the image to open the SVG viewer pop-up menu. Click
'view SVG' to display the image in a new, full window
to zoom & pan the image.
(SVG Viewer Tips)
<!DOCTYPE svg PUBLIC "-//W3C//DTD
SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
The first example is a blue square traveling along
a semicircular path over a period of 10 seconds.The
<path> element creates a visible pink
path that is drawn onscreen. The path attribute
of the <animateMotion> element has the same
values; therefore, the square appears to travel along
the curving pink line. This animation will repeat
3 times (repeatCount="3"). At the
end of the <animateMotion> element
is the fill="freeze" property;
this property is available to all animate elements
and instructs the SVG viewer that when the animation
has finished, the element is to be frozen in its final
position.
The second example creates an animation where a
text string traces the shape of a square.
The last example create an arrow to
animate along a complex path defined by the cubic
beziers and starting on the left side. The rotate
attribute defines the orientation of the arrow
as it proceeds along the path. The value auto
keeps the orientation of the arrow so that it always
points along the path. The value auto-reverse
positions the arrow so that it always points away
from the direction of motion.