运行代码 缩小
汉王
HTML代码
复制 格式化 注释 注释 清空
放大
AخA
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<title>颜色遮罩</title>
5
</head>
6
<body>
7
  <svg x="0px" y="0px" width="500px" height="500px" viewbox="0 0 500 500">
8
  <defs>
9
    <filter id="blurry" x="-20%" y="-20%" height="140%" width="140%" primitiveUnits="userSpaceOnUse">
10
      <feImage x="0" y="0" width="500" height="500" xlink:href="#squares" result="mySquares"/>
11
      <feGaussianBlur stdDeviation="40" in="mySquares" result="blurSquares"/>
12
      <feComponentTransfer in="blurSquares" result="morealpha">
13
        <feFuncA type="linear" intercept=".8"/>
14
      </feComponentTransfer>
15
      <feComposite operator="in" in="morealpha" in2="SourceGraphic" result="clipBlur"/>
16
      <feFlood x="10%" y="10%" width="80%" height="80%" flood-color="white" flood-opacity="0.6" result="whitesquare"/>
17
      <feBlend mode="screen" in="clipBlur" in2="whitesquare" result="final"/>
18
    </filter>
19
  </defs>
20
  <g id="squares">
21
    <rect x="10" y="10" height="235" width="235" fill="red" />
22
    <rect x="255" y="10" height="235" width="235" fill="green" />
23
    <rect x="10" y="255" height="235" width="235" fill="blue" />
24
    <rect x="255" y="255" height="235" width="235" fill="yellow" />
25
  </g>
26
    <rect filter="url(#blurry)" x="50" y="50" height="400" width="400"/>
27
</svg>
28
</body>
29
</html>
CSS代码
复制 格式化 注释 注释 颜色 清空
放大
CSS代码...
x
 
1
JS代码
复制 格式化 注释 注释 清空
放大
JS代码...
xxxxxxxxxx
1
 
1
名称
HTML模糊的颜色遮罩效果
分类
网站常用
描述
HTML模糊的颜色遮罩效果,好像是HTML5中的内容,运行效果后你可以看到最上面的方块遮挡了下边的四个彩色方块,从上面的方块层可以看到下面大致的轮廓,不过已经被上面的模糊化了,用了Fliter滤镜效果,仔细看下代码,还真量不太熟悉这种...
收藏