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: onload="Init(evt)">
12:
13: <title>SVG - Learning by Coding</title>
14: <desc>SVG-Spezifikation in Beispielen</desc>
15:
16: <defs>
17:
18: <style type="text/css">
19: <![CDATA[
20:
21: *
22: {
23: font-family: sans-serif;
24: font-size: 12px;
25: }
26:
27: ]]>
28: </style>
29:
30:
31: <script type="text/javascript">
32: <![CDATA[
33:
34: var svgdoc,ani1;
35:
36:
37: function Init(load_evt)
38: {
39: svgdoc=load_evt.target.ownerDocument;
40: ani1=svgdoc.getElementById("animation1");
41: }
42:
43:
44: function AnimInfo(beginend_evt,txt)
45: {
46: var info;
47: info="[Animation wurde "+txt+".]";
48: svgdoc.getElementById("infotext").firstChild.data=info;
49: }
50:
51: ]]>
52: </script>
53:
54: </defs>
55:
56: <text x="20" y="25" style="fill: #000; font-size: 24px">
57: Animationsmethoden beginElement() / endElement()</text>
58: <text x="20" y="55" style="fill: #000; font-size: 24px">
59: und beginElementAt() / endElementAt()</text>
60:
61: <circle cx="80" cy="100" r="20" style="fill: #090">
62: <animate id="animation1" attributeName="cx" attributeType="XML" from="80"
63: to="500" begin="indefinite" end="indefinite" repeatCount="indefinite" dur="10s"
64: fill="freeze" onbegin="AnimInfo(evt,'gestartet')" onend="AnimInfo(evt,'beendet')"/>
65: </circle>
66:
67: <a xlink:href="" cursor="pointer" onclick="return false">
68: <text x="30" y="150" style="fill: #F00" onclick="ani1.beginElement()">
69: Start
70: </text>
71: </a>
72:
73: <a xlink:href="" cursor="pointer" onclick="return false">
74: <text x="100" y="150" style="fill: #00C" onclick="ani1.endElement()">
75: Stopp
76: </text>
77: </a>
78:
79: <a xlink:href="" cursor="pointer" onclick="return false">
80: <text x="30" y="170" style="fill: #F00" onclick="ani1.beginElementAt(1)">
81: Start (+1s)
82: </text>
83: </a>
84:
85: <a xlink:href="" cursor="pointer" onclick="return false">
86: <text x="100" y="170" style="fill: #00C" onclick="ani1.endElementAt(2)">
87: Stopp (+2s)
88: </text>
89: </a>
90:
91: <text id="infotext" x="20" y="200" style="fill: #000"> </text>
92:
93: </svg>
[zum Anfang]