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" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">  
  <style>
svg {
  width: 96%;
  padding:0;
  height: 500px;
}

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

<svg viewBox="0 0 600 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"
         href="https://wiki.selfhtml.org/images/f/fe/Doppeldecker.svg">
        <title>Doppeldecker</title>
      </image>		
	</symbol>
  </defs>

<text x="10" y="25"> ohne Filter</text>
<use href="#bild" transform="translate(0,80) " />

<text x="200" y="25" font-weight="bold"> feDisplacementMap</text>
<text x="200" y="50">scale="1"</text>
<use href="#bild" transform="translate(200,80)" filter="url(#f1)"/>
<text x="200" y="290">scale="2"</text>
<use href="#bild" transform="translate(200,300)" filter="url(#f2)"/>

<text x="400" y="25" font-weight="bold"> zusätzlich mit feTurbulence</text>
<text x="400" y="50"> type="fractalNoise"</text>
<use href="#bild" transform="translate(400,80)" filter="url(#f3)" />
<text x="400" y="290"> type="turbulence"</text>
<use href="#bild" transform="translate(400,300)" filter="url(#f4)" /> 
	
</svg>
</body>
</html>