Beispiel:SVG-Filter-07.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0;" />
  <link rel="stylesheet" type="text/css" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css" />  
  <style>
svg {
  width: 96%;
  padding:0;
  margin:0;
  background: white;
}

 
  </style>
  <title>Beispiel: feDisplacementMap</title>
</head>
 
<body>
<h1>SVG-Filter feDisplacementMap</h1>

<main>
<svg viewbox="0 0 880 500">
  <defs>	
    <filter id="f1">
      <feDisplacementMap in="SourceGraphic" in2="SourceGraphic"
        scale="1" />
    </filter>
    <filter id="f2">
      <feDisplacementMap in="SourceGraphic" in2="SourceGraphic"
        scale="2" />
    </filter>

   <!-- zusätzlich mit feTurbulence -->
    <filter id="f3">
      <feTurbulence baseFrequency=".5" type="fractalNoise" result="out1" />
      <feDisplacementMap in="SourceGraphic" in2="out1"
        scale="5" />
    </filter>
    <filter id="f4">
      <feTurbulence baseFrequency=".5" type="turbulence" result="out1" />
      <feDisplacementMap in="SourceGraphic" in2="out1"
        scale="5" />
    </filter>
	
    <symbol id="bild" >
	  <image x="0" y="0" width="200px" height="200px"
         xlink:href="http://wiki.selfhtml.org/images/f/fe/Doppeldecker.svg">
        <title>Doppeldecker</title>
      </image>		
	</symbol>
  </defs>

  <text x="20" y="25"> ohne Filter</text>
  <use xlink:href="#bild"  transform="translate(20,50) " />
  
  <text x="250" y="25" font-weight="bold"> feDisplacementMap</text>
  <text x="250" y="50">scale="1"</text>
  <use xlink:href="#bild"  transform="translate(250,80)"
    filter="url(#f1)" />
  <text x="250" y="290">scale="2"</text>	
  <use xlink:href="#bild"  transform="translate(250,320)"
    filter="url(#f2)" />
	
  <text x="500" y="25" font-weight="bold"> zusätzlich mit feTurbulence</text> 	
  <text x="500" y="50"> type="fractalNoise"</text>
  <use xlink:href="#bild"  transform="translate(500,80)"
    filter="url(#f3)" />
  <text x="500" y="290"> type="turbulence"</text>
  <use xlink:href="#bild"  transform="translate(500,320)"
    filter="url(#f4)" />
	

</svg>


</main>

</body>
</html>