我尝试模糊SVG剪切路径没有成功。我尝试了其他解决方案,但没有一个奏效。我不确定match /documents/{docid} {
allow read: if
(
request.resource.userParams.accessBy == 'teams' &&
get(/user/<userId>).teams.has(request.resource.userParams.value) &&
get(/teams/<request.resource.userParams.value>).docs.hasAny(resource.data.rights)
||
request.resource.userParams.accessBy == 'company' &&
get(/user/<userId>).company == request.resource.userParams.value &&
get(/company/<request.resource.userParams.value>).docs.hasAny(resource.data.rights)
)
}
之外是否还有其他解决方案。
伪代码
谢谢。
HTML
filter
.wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.h1, blur {
width: 100vw;
height: 100vh;
}
.h1 {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
clip-path: url(#svgPath);
background-color: blue;
}
.blur {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
color: blue;
background-color: white;
filter: blur(8px)
}
答案 0 :(得分:2)
好的,这是一种使用radial-gradient()
作为mask-image
的方法。
var h1 = document.getElementById('masked');
document.addEventListener('mousemove', mouseListen, false);
function mouseListen(e){
setMaskPos(e.clientX,e.clientY);
}
function setMaskPos(x,y) {
h1.setAttribute("style", "-webkit-mask-image: radial-gradient(circle at " + x + "px " + y + "px, black 0px, black 200px, transparent 250px)");
}
// Initialise the mask off screen
setMaskPos(-999,0);
.wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.h1, blur {
width: 100vw;
height: 100vh;
}
.h1 {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
background-color: white;
}
.blur {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
background-color: white;
filter: blur(8px)
}
<div class="wrapper">
<h1 class="blur">
Our principles inform everything we do. Whether you're preparing content, designing an interface or developing an entire service, start by reading these.
</h1>
<h1 id="masked" class="h1">
Our principles inform everything we do. Whether you're preparing content, designing an interface or developing an entire service, start by reading these.
</h1>
</div>
答案 1 :(得分:0)
使用<mask>
而不是<clipPath>
。剪切路径不能模糊,但是<mask>
中的元素可以。
以下内容将在Firefox中运行,但在其他浏览器中将被破坏:
.wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.h1, .blur {
width: 100vw;
height: 100vh;
}
.h1 {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
-webkit-mask: url(#svgPath);
mask: url(#svgPath);
background-color: blue;
}
.blur {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
color: blue;
background-color: white;
filter: blur(8px)
}
<div class="wrapper">
<h1 class="blur">
Our principles inform everything we do. Whether you're preparing content, designing an interface or developing an entire service, start by reading these.
</h1>
<h1 class="h1">
Our principles inform everything we do. Whether you're preparing content, designing an interface or developing an entire service, start by reading these.
</h1>
</div>
<svg id="googlesMain" height="0" width="0">
<defs>
<filter id="f1" x="0" y="0">
<feGaussianBlur in="SourceGraphic" stdDeviation="15" />
</filter>
<mask id="svgPath">
<circle id="clipPath" cx="250" cy="250" r="250" fill="white" filter="url(#f1)"/>
</mask>
</defs>
</svg>
要使其在其他浏览器中运行,请尝试将其转换为独立的SVG。然后改用mask-image
CSS规则。
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="f1" x="0" y="0">
<feGaussianBlur in="SourceGraphic" stdDeviation="15" />
</filter>
</defs>
<circle cx="250" cy="250" r="250" fill="white" filter="url(#f1)" />
</svg>
使用CSS:
.h1 {
...
-webkit-mask-image: url(mask.svg);
mask-image: url(mask.svg);
...
}