gpt4 book ai didi

svg - 什么情况下SVG路径的命令可以省略?

转载 作者:行者123 更新时间:2023-12-03 08:39:03 25 4
gpt4 key购买 nike

我正在使用来自维基百科的 map 文件的 SVG 代码,并偶然发现了这个看起来很奇怪的 path 元素。

<path d="m 36.943395,239.60555 c -2.53599,-0.0564 1.53374,-0.10078 -2.36262,-0.80482 0.32392,1.46137 0.35668,3.39659 -0.2642,6.15571 -0.16424,0.73016 -0.53689,1.39667 -1.02526,1.94642 8.3e-4,0.003 -0.73141,3.09631 3.2815,0.64493 0.79653,-0.4865 0.81727,-3.85406 0.0695,-4.31941 -1.13081,-0.70362 0.19452,-0.0269 0.27789,-1.56755 0.0174,-0.32184 1.91842,-2.01319 0.0232,-2.05529 l 0,1e-5 z"/>

它似乎省略了大部分命令,只留下坐标,但不知何故在 Chrome 和 Firefox 中仍然可以正确呈现。所以我怀疑这里有一些标准(或者至少是事实上的标准)。然而,经过一番搜索,我找不到任何关于可选命令和/或命令遗漏的引用。

有人可以解释一下这个path是如何解释的吗?命令省略是否有任何标准?谢谢。

最佳答案

SVG specification解释一下。

通常前面的命令会重复,除了移动变成线。这在文本here中有解释。

The command letter can be eliminated on subsequent commands if the same command is used multiple times in a row (e.g., you can drop the second "L" in "M 100 200 L 200 100 L -100 -200" and use "M 100 200 L 200 100 -100 -200" instead).

所以你的路径相当于一个 m 后面跟着多个 c 命令。

关于svg - 什么情况下SVG路径的命令可以省略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63109024/

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