Safari浏览器过滤问题( Filter issue with Safari)

编程入门 行业动态 更新时间:2024-10-10 21:33:15
Safari浏览器过滤问题( Filter issue with Safari)

我曾四处寻找这个问题的答案,但我找到的解决方案都不能解决问题。

我应用了filter <path>在Safari(我正在运行11.0.2)或Firefox(57.0.4)中不呈现。

这是我的代码:

<!-- html --> <svg viewBox="0 0 88 88" xmlns="http://www.w3.org/2000/svg"> <defs> <filter id="glow" x="-50%" y="-50%" width="200%" height="200%"> <feGaussianBlur in="sourceAlpha" stdDeviation="2"/> <feComponentTransfer> <feFuncA type="linear" slope=".21"/> </feComponentTransfer> <feMerge> <feMergeNode in="coloredBlur"/> <feMergeNode in="SourceGraphic"/> </feMerge> </filter> </defs> <path d="M69.45584,18.54416a36,36,0,1,1-50.91168,0"/> <path d="M18.54416,18.54416a36,36,0,0,1,50.91168,0" filter="url(#glow)"/> </svg> /* css / scss */ path { fill: none; stroke-linecap: round; stroke-miterlimit: 10; @include rem(stroke-width, 8); // 8px @include pseudo(nth-of-type(unquote('2n+1'))) { stroke: rgba(38, 38, 38, .03) } @include pseudo(nth-of-type(unquote('2n'))) { stroke: rgb(0, 131, 202); } }

这个应用了filter path在Chrome中呈现。 一旦我删除了filter的引用,就会显示出所有应用的CSS。

任何援助将不胜感激。

I have looked around for a previous answer to this issue, but none of the solutions I have found resolve the issue.

My <path> with a filter applied to it doesn't render in Safari (I'm running 11.0.2) or Firefox (57.0.4).

Here is my code:

<!-- html --> <svg viewBox="0 0 88 88" xmlns="http://www.w3.org/2000/svg"> <defs> <filter id="glow" x="-50%" y="-50%" width="200%" height="200%"> <feGaussianBlur in="sourceAlpha" stdDeviation="2"/> <feComponentTransfer> <feFuncA type="linear" slope=".21"/> </feComponentTransfer> <feMerge> <feMergeNode in="coloredBlur"/> <feMergeNode in="SourceGraphic"/> </feMerge> </filter> </defs> <path d="M69.45584,18.54416a36,36,0,1,1-50.91168,0"/> <path d="M18.54416,18.54416a36,36,0,0,1,50.91168,0" filter="url(#glow)"/> </svg> /* css / scss */ path { fill: none; stroke-linecap: round; stroke-miterlimit: 10; @include rem(stroke-width, 8); // 8px @include pseudo(nth-of-type(unquote('2n+1'))) { stroke: rgba(38, 38, 38, .03) } @include pseudo(nth-of-type(unquote('2n'))) { stroke: rgb(0, 131, 202); } }

This path with the filter applied to it renders in Chrome. As soon as I remove the reference to the filter the path shows up with all css applied.

Any assistance would be much appreciated.

最满意答案

没有像sourceAlpha这样的输入。 正确的名称是SourceAlpha 。

我目前无法在Safari上进行测试,但它修复了Firefox中的问题。

path {
  fill: none;
  stroke-linecap: round;
  stroke-miterlimit: 10;
  stroke-width: 8;
  stroke: rgba(38, 38, 38, .03);
  stroke: rgb(0, 131, 202);
}

path:nth-of-type(2n+1) {
  stroke: rgba(38, 38, 38, .03);
}

path:nth-of-type(2n) {
  stroke: rgb(0, 131, 202);
} 
  
<svg viewBox="0 0 88 88" xmlns="http://www.w3.org/2000/svg">
    <defs>
        <filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
            <feGaussianBlur in="SourceAlpha" stdDeviation="2"/>
            <feComponentTransfer result="blur">
                <feFuncA type="linear" slope=".21"/>
            </feComponentTransfer>
             <feMerge>
                <feMergeNode in="blur"/>
                <feMergeNode in="SourceGraphic"/>
            </feMerge>
        </filter>
    </defs>
    <path d="M69.45584,18.54416a36,36,0,1,1-50.91168,0"/>
    <path d="M18.54416,18.54416a36,36,0,0,1,50.91168,0" filter="url(#glow)"/>
</svg> 
  
 

There is no such input as sourceAlpha. The correct name is SourceAlpha.

I can't currently test on Safari, but it fixes the problem in Firefox.

path {
  fill: none;
  stroke-linecap: round;
  stroke-miterlimit: 10;
  stroke-width: 8;
  stroke: rgba(38, 38, 38, .03);
  stroke: rgb(0, 131, 202);
}

path:nth-of-type(2n+1) {
  stroke: rgba(38, 38, 38, .03);
}

path:nth-of-type(2n) {
  stroke: rgb(0, 131, 202);
} 
  
<svg viewBox="0 0 88 88" xmlns="http://www.w3.org/2000/svg">
    <defs>
        <filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
            <feGaussianBlur in="SourceAlpha" stdDeviation="2"/>
            <feComponentTransfer result="blur">
                <feFuncA type="linear" slope=".21"/>
            </feComponentTransfer>
             <feMerge>
                <feMergeNode in="blur"/>
                <feMergeNode in="SourceGraphic"/>
            </feMerge>
        </filter>
    </defs>
    <path d="M69.45584,18.54416a36,36,0,1,1-50.91168,0"/>
    <path d="M18.54416,18.54416a36,36,0,0,1,50.91168,0" filter="url(#glow)"/>
</svg> 
  
 

更多推荐

本文发布于:2023-08-05 18:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1437199.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   Safari   issue   Filter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!