XML technologies / SVG / Using animations / Solutions
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
Create the square with the instruction
<rect x="0" y="0" width="4" height="4"/>.To fill it red, add to that tag
style="fill:red".Add animation by placing the
<animateColor>tag inside the<rect>tag.
<rect x="0" y="0" width="4" height="4" style="fill:red">
<animateColor dur="10s" from="red" to="black" attributeName="fill" fill="freeze"/>
</rect>
Since both height and width must change, add two more
<animate>tags to the<rect>tag.
<animate dur="5s" begin="10s" from="4" to="8" attributeName="width" fill="freeze"/>
<animate dur="5s" begin="10s" from="4" to="8" attributeName="height" fill="freeze"/>
Create the line with
<line x1="0" y1="0" x2="75" y2="10"/>.The line cannot serve directly as an animation path, so also use the
<animateMotion>tag’spathattribute:
<animateMotion path="M0 0 L75 10" dur="8s" fill="freeze"/>
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