gpt4 book ai didi

svg - SVG 图案中使用的圆帽线

转载 作者:行者123 更新时间:2023-12-04 21:04:00 28 4
gpt4 key购买 nike

目前正在使用 SVG <pattern>元素与一堆 <line>元素将使它具有一种逐渐变细的边缘。我尝试了很多不同的 CSS 样式来解决这个问题,但没有任何效果。这是一个带有针迹的圆圈的代码:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="500" width="500">
<defs>
<pattern id="stripe" patternUnits="userSpaceOnUse" width="20" height="20">
<line x1="0" y1="0" x2="20" y2="20" />
</pattern>
<mask id="mask">
<rect height="500" width="500" style="fill: url(#stripe)" />
</mask>
<style>
#stripe line {
fill: white;
stroke: white;
stroke-linecap: square;
stroke-linejoin: miter;
stroke-width: 10px;
}
g {
mask: url(#mask);
stroke-linecap: square;
stroke-linejoin: miter;
}
circle {
fill: green;
}
</style>
</defs>
<g>
<circle cx="250" cy="250" r="200" style="fill: rgba(0, 255, 0, 0.2);" />
</g>
</svg>

这里是 a fiddle这看起来像什么。没有 stoke-linecap 的组合和 stroke-linejoin为我工作。我是否需要画一个完整的 <path>穿过整个面具?

感谢您的帮助。

最佳答案

好吧,我知道这个答案已经晚了 2 年了,但我在研究另一个问题时偶然发现了这个问题,我想我会为可能遇到它的任何人投入我的 2 美分。

这里的问题正如 Duopixel 强调的那样:图案没有正确平铺。

您的解决方案肯定通过叠加两个非平铺图案来隐藏非平铺角来掩盖问题,但是如果您使图案更宽并添加彼此偏移的额外线条,然后偏移以确保它们永远不会重叠您可以在瓷砖的一角创建功能图案。您可以一直向上增加笔划宽度,而不会出现任何角问题。

<pattern id="stripe" patternUnits="userSpaceOnUse" width="40" height="20">
<line x1="-10" y1="0" x2="10" y2="20" />
<line x1="10" y1="0" x2="30" y2="20" />
<line x1="30" y1="0" x2="50" y2="20" />
</pattern>

参见 this fiddle

不过,我其实很喜欢原始问题制作的图案!我可能必须在某个地方找到它的用途:)

关于svg - SVG 图案中使用的圆帽线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11962077/

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