gpt4 book ai didi

css - 你能基于渐变蒙版进行 CSS 模糊吗?

转载 作者:太空狗 更新时间:2023-10-29 12:26:05 26 4
gpt4 key购买 nike

你能基于渐变 mask 进行 CSS 模糊处理吗?

类似于此效果的东西,http://www.imagemagick.org/Usage/mapping/#blur

最佳答案

这可以帮助你http://codepen.io/iamvdo/pen/xECmI

.effet{
width: 400px; height: 300px;
margin: 0 auto 50px auto;
box-shadow: 0 1px 5px rgba(0,0,0,.5);
}
.effet img{
position: absolute;
}
.filtre--r{
-webkit-mask: -webkit-radial-gradient( center, closest-side, transparent 30%, black 80%);
-webkit-mask: radial-gradient( closest-side at center, transparent 50%, black 110%);
-webkit-filter: blur(5px);
mask: url('#mask-radial');
filter: url('#filtre1');
}
.filtre--l{
-webkit-mask: -webkit-linear-gradient(black, transparent 30%, black);
-webkit-mask: linear-gradient(black, transparent 30%, black);
-webkit-filter: blur(3px);
mask: url('#mask-linear');
filter: url('#filtre2');
}
.filtre:hover{
-webkit-mask: none;
-webkit-filter: none;
mask: none;
filter: none;
}
p{
text-align: center;
color: rgba(0,0,0,.6);
margin: 1em;
}
p a{
color: rgba(0,0,0,.6);
}
<p><strong>Radial</strong> progressive blur</p>
<div class="effet">
<img src="http://css3create.com/squelettes/images/articles/flou-localise-1.jpg" alt="" />
<img class="filtre filtre--r" src="http://css3create.com/squelettes/images/articles/flou-localise-1.jpg" alt="" />
</div>
<p><strong>Linear</strong> progressive blur</p>
<div class="effet">
<img src="http://css3create.com/squelettes/images/articles/flou-localise-2.jpg" alt="" />
<img class="filtre filtre--l" src="http://css3create.com/squelettes/images/articles/flou-localise-2.jpg" alt="" />
</div>
<p>Hover over images to see without blur</p>
<p>Next demo: <a href="http://codepen.io/iamvdo/pen/djEBu" target="_blank">iOS 7 background blur with CSS</a></p>
<svg height="0">
<defs>
<mask id="mask-radial">
<rect width="400" height="300" fill="url(#g1)"></rect>
<radialGradient id="g1" cx="50%" cy="50%" r="50%">
<stop stop-color="black" offset="50%"/>
<stop stop-color="white" offset="110%"/>
</radialGradient>
</mask>
<mask id="mask-linear">
<rect width="400" height="300" fill="url(#l1)"></rect>
<linearGradient id="l1" x1="0" y1="0" x2="0" y2="1">
<stop stop-color="white" offset="0%"/>
<stop stop-color="black" offset="30%"/>
<stop stop-color="white" offset="100%"/>
</linearGradient>
</mask>
<filter id="filtre1">
<feGaussianBlur in="SourceGraphic" stdDeviation="5"/>
</filter>
<filter id="filtre2">
<feGaussianBlur in="SourceGraphic" stdDeviation="3"/>
</filter>
</defs>
</svg>

关于css - 你能基于渐变蒙版进行 CSS 模糊吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20648881/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com