gpt4 book ai didi

javascript - 没有 xlink 的 SVG textPath

转载 作者:搜寻专家 更新时间:2023-10-31 08:43:49 26 4
gpt4 key购买 nike

是否可以内联定义 textPath 的路径,而不是创建 def 并将其作为 xlink:href 作为属性引用?

  <defs>
<path id="MyPath"
d="M 100 200
C 200 100 300 0 400 100" />
</defs>

<use xlink:href="#MyPath"/>

<text>
<textPath xlink:href="#MyPath">
My text along a path
</textPath>
</text>

那么有没有可能有类似的东西

<text>
<textPath path="M 100 200 C 200 100 300 0 400 100">
My text along a path
</textPath>
</text>

这行不通,但像这样?

最佳答案

这是一个feature在新的 SVG 2 规范中,您将使用路径属性。

浏览器正在实现新的 SVG 2 功能。下面的示例在 Firefox 中确实有效,但不确定其他地方。

html, body {
height: 100%;
width: 100%;
}
<svg height="100%" width="100%">
<text>
<textPath path="M 100 200 C 200 100 300 0 400 100">
My text along a path
</textPath>
</text>
</svg>

关于javascript - 没有 xlink 的 SVG textPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30654713/

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