Beispiel:SVG-Filter-01-Blend.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: feBlend</title>
</head>
 
<body>
  <h1>SVG-Filter feBlend</h1>
 
  <main>

<svg  viewBox="0 0 880 500" >
<defs>
  <symbol id="kreis">
    <circle  cx="50" cy="50" r="50" fill="#3983ab" ></circle>
  </symbol>	
  <symbol id="viereck">
    <rect x="0" y="0" width="100" height="100" fill="#dfac20" />
  </symbol>
  <symbol id="rastergrafik">
    <image x="0" y="0" width="100px" height="100px"
    xlink:href="http://wiki.selfhtml.org/images/a/a6/Lauf-1.jpg">
  </symbol>

<!-- 5 Filter mit feBlend und feTurbulence -->
    <filter id="blend1">
      <feTurbulence in="SourceGraphic"
         baseFrequency=".2" type="fractalNoise"
        result="out1" />
      <feBlend in="SourceGraphic" in2="out1"
        mode="normal" />
    </filter>
    <filter id="blend2">
      <feTurbulence in="SourceGraphic"
        baseFrequency=".2" type="fractalNoise"
        result="out1" />
      <feBlend in="SourceGraphic" in2="out1"
        mode="screen" />
    </filter>
    <filter id="blend3">
      <feTurbulence in="SourceGraphic"
        baseFrequency=".2" type="fractalNoise"
        result="out1" />
      <feBlend in="SourceGraphic" in2="out1"
        mode="darken" />
    </filter>
    <filter id="blend4">
      <feTurbulence in="SourceGraphic"
        baseFrequency=".2" type="fractalNoise"
        result="out1" />
      <feBlend in="SourceGraphic" in2="out1"
        mode="lighten" />
    </filter>
    <filter id="blend5">
      <feTurbulence in="SourceGraphic"
        baseFrequency=".2" type="fractalNoise"
        result="out1" />
      <feBlend in="SourceGraphic" in2="out1"
        mode="multiply" />
    </filter>

</defs>

  <!-- mode="normal" -->
  <text  x="50" y="22">normal</text>
  <use xlink:href="#kreis"
        transform="translate(50,50)"
           filter="url(#blend2)" 
  />
  <use xlink:href="#viereck"
        transform="translate(50,200)"
           filter="url(#blend2)" 
  />
    <use xlink:href="#rastergrafik"
        transform="translate(50,350)"
           filter="url(#blend2)" 
  />
 
  <!-- mode="screen" -->
  <text  x="200" y="22">screen</text>
  <use xlink:href="#kreis"
        transform="translate(200,50)"
           filter="url(#blend2)" 
  />
  <use xlink:href="#viereck"
        transform="translate(200,200)"
           filter="url(#blend2)" 
  />
    <use xlink:href="#rastergrafik"
        transform="translate(200,350)"
           filter="url(#blend2)" 
  />
 
  <!-- mode="darken" -->
  <text  x="350" y="22">darken</text>
  <use xlink:href="#kreis"
        transform="translate(350,50)"
           filter="url(#blend3)" 
  />
  <use xlink:href="#viereck"
        transform="translate(350,200)"
           filter="url(#blend3)" 
  />
  <use xlink:href="#rastergrafik"
        transform="translate(350,350)"
           filter="url(#blend3)" 
  />
  <!-- mode="lighten" -->
  <text  x="500" y="22">lighten</text>
  <use xlink:href="#kreis"
        transform="translate(500,50)"
           filter="url(#blend4)" 
  />
  <use xlink:href="#viereck"
        transform="translate(500,200)"
           filter="url(#blend4)" 
  />
  <use xlink:href="#rastergrafik"
        transform="translate(500,350)"
           filter="url(#blend4)" 
  />
  
    <!--mode="multiply" -->
  <text  x="650" y="22">multiply</text>
  <use xlink:href="#kreis"
        transform="translate(650,50)"
           filter="url(#blend5)" 
  />
  <use xlink:href="#viereck"
        transform="translate(650,200)"
           filter="url(#blend5)" 
  />
  <use xlink:href="#rastergrafik"
        transform="translate(650,350)"
           filter="url(#blend5)" 
  />
 

</svg>


  </main>

</body>
</html>