SVG – Learning by Coding

[ transform.svg --> Grafik anzeigen ]

 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: <!--    AuthorDrThomas Meinike 12/02 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:       *
21:       {
22:         font-familysans-serif;
23:         font-size12px;
24:       }
25: 
26:       ]]>
27:     </style>
28: 
29: 
30:     <script type="text/javascript">
31:       <![CDATA[
32: 
33:       function getMatrix(click_evt)
34:       {
35:         var objekt,trans,matrix,a,b,c,d,e,f,ausgabe;
36: 
37:         objekt=click_evt.target;
38:         trans=objekt.getAttribute("transform");
39: 
40:         matrix=objekt.getCTM();
41:         a=matrix.a;
42:         b=matrix.b;
43:         c=matrix.c;
44:         d=matrix.d;
45:         e=matrix.e;
46:         f=matrix.f;
47: 
48:         ausgabe="transform=\""+trans+"\"\ngetCTM()=\"";
49:         ausgabe+="matrix("+a+","+b+","+c+","+d+","+e+","+f+")\"";
50:         alert(ausgabe);
51:       }
52: 
53:       ]]>
54:     </script>
55: 
56:   </defs>
57: 
58:   <text x="20" y="30" style="fill: #000; font-size: 24px">
59:    Transformationen (translate rotate scale skewX skewY)
60:   </text>
61: 
62:   <rect transform="translate(270,100)" x="50" y="80" width="150" height="75"
63:     style="fill: #FFC; stroke: #F00; stroke-width: 1.5px" onclick="getMatrix(evt)"/>
64: 
65:   <rect transform="rotate(90,70,300)" x="50" y="80" width="150" height="75"
66:     style="fill: #FFC; stroke: #F00; stroke-width: 1.5px" onclick="getMatrix(evt)"/>
67: 
68:   <rect transform="scale(0.75,0.5)" x="50" y="80" width="150" height="75"
69:     style="fill: #FFC; stroke: #F00; stroke-width: 1.5px" onclick="getMatrix(evt)"/>
70: 
71:   <rect transform="skewX(30)" x="50" y="100" width="150" height="75"
72:     style="fill: #FFC; stroke: #F00; stroke-width: 1.5px" onclick="getMatrix(evt)"/>
73: 
74:   <rect transform="skewY(45)" x="50" y="80" width="150" height="75"
75:     style="fill: #FFC; stroke: #F00; stroke-width: 1.5px" onclick="getMatrix(evt)"/>
76: 
77:   <text x="220" y="65">Dieses Beispiel wurde auch mittels <tspan style="fill: #00C">
78:     matrix()</tspanumgesetzt:</text>
79:   <a xlink:href="../?doc=matrix&amp;znr=on" target="_top">
80:     <text x="515" y="65" style="fill: #F00">
81:       <set attributeName="fill" attributeType="CSS" to="#00C" begin="mouseover"/>
82:       <set attributeName="fill" attributeType="CSS" to="#F00" begin="mouseout"/>
83:       matrix.svg<tspan style="fill: #000">.</tspan>
84:     </text>
85:   </a>
86: 
87:   <text x="320" y="410">Beim Anklicken der transformierten Objekte wird die intern</text>
88:   <text x="320" y="430">verwendete matrix()-Operation mit <tspan style="fill: #00C">
89:    getCTM()</tspansichtbar gemacht.</text>
90: 	
91: </svg>

[zum Anfang]