XML technologies / SVG / Using animations / Ways to implement animations / Universal attributes for animations
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
All the attributes below apply to every animation type: they are the universal animation attributes.
xlink:hrefspecifies the SVG element to animate. With it, define the animation in the file’s<defs>section rather than inside the target element. If that element is named, specify its name with thexlink:hrefattribute. The next listing adapts the previous example: name the animated circle and add thexlink:hrefattribute to the animation definitions.attributeNamenames the attribute or property affected by the animation.attributeTypespecifies the namespace to which the value ofattributeNamerefers. Available values areCSS,XMLandauto. The valueCSSmeans a stylesheet property or a property of thestyleattribute. The valueXMLmeans an SVG tag attribute. It must exist on the target tag, be explicitly specified, and support animation. If this attribute is omitted,autois used: the browser or plug-in searches for a match, first among the properties of thestyleattribute or stylesheet, then among the tag’s attributes if no property with the given name is found.
<defs>
<animate xlink:href="#Kreis" dur="2s" begin="4s" from="6" to="3" attributeName="r" />
<animateMotion xlink:href="#Kreis" dur="6s" path="M0 0 Q203 16 85 55" />
<animateColor xlink:href="#Kreis" dur="6s" from="red" to="yellow" attributeName="fill" />
<animate xlink:href="#Kreis" dur="4s" from="3" to="6" attributeName="r" />
</defs>
...
<circle id="Kreis" cx="130" cy="80" r="3" style="fill:red;stroke:none" />
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top