SVG – Learning by Coding
1: <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2: <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
3: "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
4: <!ATTLIST svg xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
5: ]>
6:
7: <!-- SVG - Learning by Coding - http://www.datenverdrahten.de/svglbc/ -->
8: <!-- Author: Dr. Thomas Meinike 03/03 - thomas@handmadecode.de -->
9:
10: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
11:
12: <title>SVG - Learning by Coding</title>
13: <desc>SVG-Spezifikation in Beispielen</desc>
14:
15: <defs>
16:
17: <style type="text/css">
18: <![CDATA[
19:
20: .ampel
21: {
22: fill: none;
23: stroke: #000;
24: stroke-width: 2px;
25: }
26:
27: line
28: {
29: stroke: #000;
30: stroke-width: 2px;
31: }
32:
33: ]]>
34: </style>
35:
36: </defs>
37:
38: <text x="20" y="30" style="fill: #000; font-size: 24px">Ampel-Animation</text>
39:
40: <rect class="ampel" x="100" y="60" width="30" height="100"/>
41: <line x1="100" y1="230" x2="130" y2="230"/>
42: <line x1="115" y1="160" x2="115" y2="230"/>
43:
44: <circle id="k1" class="ampel" cx="115" cy="80" r="10"/>
45: <circle id="k2" class="ampel" cx="115" cy="110" r="10"/>
46: <circle id="k3" class="ampel" cx="115" cy="140" r="10"/>
47:
48: <animate attributeName="fill" attributeType="CSS" begin="0s;gelb.end"
49: xlink:href="#k3" dur="0.01s" from="none" to="#0F0" fill="freeze"/>
50:
51: <animate attributeName="fill" attributeType="CSS" begin="prev.end+6s"
52: xlink:href="#k2" dur="0.01s" from="none" to="#FF0" fill="freeze"/>
53: <animate attributeName="fill" attributeType="CSS" begin="prev.begin"
54: xlink:href="#k3" dur="0.01s" from="#0F0" to="none" fill="freeze"/>
55:
56: <animate attributeName="fill" attributeType="CSS" begin="prev.end+3s"
57: xlink:href="#k1" dur="0.01s" from="none" to="#F00" fill="freeze"/>
58: <animate attributeName="fill" attributeType="CSS" begin="prev.begin"
59: xlink:href="#k2" dur="0.01s" from="#FF0" to="none" fill="freeze"/>
60:
61: <animate attributeName="fill" attributeType="CSS" begin="prev.end+6s"
62: xlink:href="#k2" dur="0.01s" from="none" to="#FF0" fill="freeze"/>
63: <animate attributeName="fill" attributeType="CSS" begin="prev.begin"
64: xlink:href="#k1" dur="0.01s" from="#F00" to="none" fill="freeze"/>
65:
66: <animate attributeName="fill" attributeType="CSS" begin="prev.end+3s"
67: xlink:href="#k2" id="gelb" dur="0.01s" from="#FF0" to="none" fill="freeze"/>
68:
69: </svg>
[zum Anfang]