SVG показывает обрезанный край
Что я могу сделать, используя собственный синтаксис SVG или CSS, чтобы этот обрезанный край не появлялся в моем SVG?
body {
margin: 0;
background: #fff;
text-align: center;
}
#profile-pic {
width: 33%;
}
#profile-pic text {
font-size: 48px;
font-family: monospace;
font-weight: bold;
fill: #000;
-webkit-animation: raise 1s linear infinite alternate;
animation: raise 1s linear infinite alternate;
}
@-webkit-keyframes raise {
from { transform: translateY(-10px); }
to { transform: translateY(10px); }
}
@keyframes raise {
from { transform: translateY(-10px); }
to { transform: translateY(10px); }
}
<svg id="profile-pic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 500 500">
<title>Brandon McConnell</title>
<defs>
<clipPath id="imageClipPath"><circle cx="250" cy="250" r="116" fill="#FFFFFF" /></clipPath>
</defs>
<text dy="70" textLength="500">Lorem Ipsum</text>
<image
href="https://s.gravatar.com/avatar/6e25e38e140dda7ac64f7865b3df77ab?s=500"
clip-path="url(#imageClipPath)"
width="240"
height="240"
x="130"
y="130"
/>
</svg>
Я вижу это в последней версии Chrome. Скриншот:
https://i.stack.imgur.com/ZCfll.png
Системные характеристики:
MacBook Pro (Retina, 15-inch, Late 2013)
macOS Big Sure - Version 11.6.1 (20G224)
Google Chrome - Version 95.0.4638.69 (Official Build) (x86_64)
Свободный перевод вопроса SVG shows clipped edge от участника @Brandon McConnell.
Ответы (1 шт):
Автор решения: Alexandr_TT
→ Ссылка
Это известная ошибка Chrome.
https://bugs.chromium.org/p/chromium/issues/detail?id=1171601
А пока можно обойтись без маски.
body {
margin: 0;
background: #fff;
text-align: center;
}
#profile-pic {
width: 33%;
}
#profile-pic text {
font-size: 48px;
font-family: monospace;
font-weight: bold;
fill: #000;
-webkit-animation: raise 1s linear infinite alternate;
animation: raise 1s linear infinite alternate;
}
@-webkit-keyframes raise {
from { transform: translateY(-10px); }
to { transform: translateY(10px); }
}
@keyframes raise {
from { transform: translateY(-10px); }
to { transform: translateY(10px); }
}
<svg id="profile-pic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 500 500">
<title>Brandon McConnell</title>
<defs>
<mask id="imageClipPath"><circle cx="250" cy="250" r="116" fill="white" /></mask>
</defs>
<text dy="70" textLength="500">Lorem Ipsum</text>
<image
href="https://s.gravatar.com/avatar/6e25e38e140dda7ac64f7865b3df77ab?s=500"
mask="url(#imageClipPath)"
width="240"
height="240"
x="130"
y="130"
/>
</svg>
Свободный перевод ответа от участника @Paul LeBeau.