Как это исправить -> Instagram Stories SVG выглядит на iOS / Safari с фильтрами, feGaussianBlur и feColorMatrix, которые не работают должным образом. Отлично в Chrome - PullRequest
0 голосов
/ 13 марта 2020

Я пытаюсь получить липкий эффект с SVG, как истории в Instagram.

В chrome все хорошо, но в Safari и iOS выглядят странно.

Как это выглядит Chrome:

Chrome screenshot

и как это выглядит в Safari:

Safari screenshot

Проблема в том, что радиус границы в углу иногда отсутствует, другой круг выпуклый. Ничего из этого не является проблемой для chrome.


<main> 

<section class="section-2-b">
  <div class="wrapper-a">

<h1 id="left-align-text">
    <div class="goo" contenteditable="true">&nbsp;This&nbsp;<br>&nbsp;is an example&nbsp;<br>&nbsp;of a simple headline&nbsp;<br>&nbsp;or text </div>
</h1>

    <br>  <br>

    <h1 id="left-align-text">
    <div class="goo" contenteditable="true">&nbsp;This&nbsp;<br>&nbsp;is an example&nbsp;<br> </div>
</h1>

<!-- Filter: https://css-tricks.com/gooey-effect/ -->
<svg style="visibility: hidden; position: absolute;" width="0" height="0" xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
        <filter id="goo"><feGaussianBlur in="SourceGraphic" stdDeviation="3" result="blur" />    
            <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 18 -9" result="goo" />
            <feComposite in="SourceGraphic" in2="goo" operator="atop"/>
        </filter>
    </defs>
</svg>

      </div>  
    </section>   

 <section class="section-1-a">
  <div class="wrapper-b">


<h1 id="center-align-text">
    <div class="goo" contenteditable="true">This&nbsp;<br>&nbsp;is an example&nbsp;<br>&nbsp;of a simple headline&nbsp;<br>&nbsp;or text <br>&nbsp;with rounded&nbsp;<br>&nbsp;corners&nbsp;<br>&nbsp;a gooey filter.&nbsp;<br>&nbsp;cool&nbsp;</div>
</h1>

<!-- Filter: https://css-tricks.com/gooey-effect/ -->
<svg style="visibility: hidden; position: absolute;" width="0" height="0" xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
        <filter id="goo"><feGaussianBlur in="SourceGraphic" stdDeviation="3" result="blur" />    
            <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="goo" />
            <feComposite in="SourceGraphic" in2="goo" operator="atop"/>
        </filter>
    </defs>
</svg>

      </div>  
    </section>   

</main>
:root {
    --color-bg: black;
    --color-bg2: white;
    --color-highlight: red;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

*, body, main, div, img {
    margin: 0;
    padding: 0;
  max-width: 100% !important;
}
html, body {
width: 100%;
height: 100%;
overflow-x: hidden;  
}
main {
  max-width: 100% !important;
}

.wrapper-a{
  background: url("https://66.media.tumblr.com/5be0d33c4e6d9f0bdfdad71c01973c70/tumblr_pomsixQ9pG1xmzftzo3_r1_1280.jpg") center;
  background-size:cover;
  height:100vh;
  padding:5rem;box-sizing:border-box;}
.wrapper-b{
  background: url("https://66.media.tumblr.com/ad7c69e0ce19df9cb26aad0b126b943e/tumblr_plj87sq87s1xmzftzo1_1280.jpg") center;
  background-size:cover;
  height:200vh;
  padding:5rem;box-sizing:border-box;}


#center-align-text{  color:white; text-align: -webkit-center;}
#left-align-text  {  color:white;                            }

.goo {  
    font-size: 2rem;
    line-height: 1.35;
    display: inline;
    box-decoration-break: clone;
    background: var(--color-highlight);
    padding: 0.5rem 1.2rem;
    filter: url('#goo');
}

.goo:focus {
    outline: 0;
}


body {
    //padding: 7.5vh 100px 0 100px;
    font-family: var(--font);
    //background: url("https://66.media.tumblr.com/feffda2237b778e5f9a697693478b196/tumblr_pu1apbcqeS1xmzftzo2_1280.jpg") center;
   //background-size:cover;;
}

Драгоценная помощь для решения этой проблемы в Safari и Ios:

FIDDLE: https://jsfiddle.net/CAT999/r9o43bL5/

...