实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<svg xmlns="https://www.w3.org/2000/svg" version="1.1">
6
  <defs> 
7
    <linearGradient id="MyGrad" gradientUnits="userSpaceOnUse" x1="100" y1="0" x2="500" y2="0"> 
8
      <stop offset="0" style="stop-color:#ff00ff" /> 
9
      <stop offset=".33" style="stop-color:#88ff88" /> 
10
      <stop offset=".67" style="stop-color:#2020ff" /> 
11
      <stop offset="1" style="stop-color:#d00000" /> 
12
    </linearGradient> 
13
    <filter id="Matrix"> 
14
      <feColorMatrix type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0" /> 
15
    </filter> 
16
    <filter id="Saturate"> 
17
      <feColorMatrix type="saturate" values="0.4" /> 
18
    </filter> 
19
    <filter id="HueRotate"> 
20
      <feColorMatrix type="hueRotate" values="90" /> 
21
    </filter> 
22
    <filter id="Luminance"> 
23
      <feColorMatrix type="luminanceToAlpha" result="a" /> 
24
      <feComposite in="SourceGraphic" in2="a" operator="in" /> 
25
    </filter> 
26
  </defs> 
27
  <g style="font-size:50;fill:url(#MyGrad)">
28
    <text x="50" y="60">Unfiltered</text> 
29
    <text x="50" y="120" filter="url(#Matrix)">Matrix</text> 
30
    <text x="50" y="180" filter="url(#Saturate)">Saturate</text> 
31
    <text x="50" y="240" filter="url(#HueRotate)">HueRotate</text> 
32
    <text x="50" y="300" filter="url(#Luminance)">Luminance</text> 
33
  </g> 
34
</svg>
35
36
</body>
37
</html>