XML technologies / SVG / Using animations / Changing colors
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
Element colors can be changed with the tag <animateColor>. The next example uses it to change the color of the circle previously animated. Below the tag <animateMotion>, insert the tag <animateColor>:
<animateColor dur="6s" from="red" to="yellow" attributeName="fill" />Again, dur sets the duration, from the starting color, and to the final color. The attribute attributeName determines whether the fill or border color should change. Thus, fill changes the fill, leaving the border color unchanged.
Here the color changes from red to yellow. The final color is reached when the circle reaches its destination, since this animation lasts as long as the movement animation.
Note:
Both tags, <animateMotion> and <animateColor>, have additional attributes explained in more detail under Ways to implement animations.
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