SVG – Learning by Coding

[ vectorEffect.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 11/04 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: 
  <text x="20" y="30" style="fill: #000; font-size: 24px">

16: 
    Vektoreffekt &quot;Schiene&quot;</text>

​17: 18: 
  <text x="20" y="190" style="fill: #000; font-size: 14px">

19: 
    SVG 1.2 bietet spezielle Techniken für Vektoreffekte

20: 
    (Element <tspan fill="#F00">vectorEffect</tspan>, siehe Code)</text>

​21: 22: 
  <!-- Schiene mit zwei ueberlagerten Linien -->

23: 
  <line x1="20" y1="150" x2="520" y2="150"

24: 
    fill="none" stroke="#000" stroke-width="8"/>

25: 
  <line x1="20" y1="150" x2="520" y2="150"

26: 
    fill="none" stroke="#FFF" stroke-width="4" stroke-dasharray="10,2"/>

​27: 28: 
  <!-- Schiene mit zwei ueberlagerten Pfaden -->

29: 
  <path d="M24 126 C112.221 15.7232 148.151 115.252 240 124 C286.121 128.392

30: 
    280.354 73.8769 323 70 C393.552 63.5862 447.861 114.896 515 121"

31: 
    fill="none" stroke="#000" stroke-width="8"/>

32: 
  <path d="M24 126 C112.221 15.7232 148.151 115.252 240 124 C286.121 128.392

33: 
    280.354 73.8769 323 70 C393.552 63.5862 447.861 114.896 515 121"

34: 
    fill="none" stroke="#FFF" stroke-width="4" stroke-dasharray="10,2"/>

​35: 36: 
  <!-- SVG 1.2 ermoeglicht die Realisierung der Schiene als Vektoreffekt:

​37: 38: 
  Definition:

​39: 40: 
  <vectorEffect id="schiene">

41: 
    <veStroke fill="none" stroke="#000" stroke-width="8"

42: 
      in="SourcePath"/>

43: 
    <veStroke fill="none" stroke="#FFF" stroke-width="4"

44: 
      stroke-dasharray="10,2" in="SourcePath"/>

45: 
  </vectorEffect>

​46: 47: 
  Anwendung auf ein SVG-Element wie linepath usw.:

​48: 49: 
  <line x1="20" y1="20" x2="520" y2="20" vector-effect="url(#schiene)"/>

​50: 51: 
  -->

​52: 53: 
</svg>

[zum Anfang]