SVG路径圆弧半径比
我见过的关于 SVG
的 d
属性的 ArcTo 指令的所有文档都给出了前两个参数作为 x 和 y 半径弧线。
不过,早些时候,我在玩,在 FF8 和 Safari 5 中,看起来路径
<path d="M 100 100 A 50 50 0 0 0 200 100 Z"/>
和渲染的路径
<path d="M 100 100 A 1 1 0 0 0 200 100 Z"/>
是相同的。经过更多的尝试,似乎真正使用的是 rx 和 ry 之间的比率。这是有道理的(因为如果当前位置超过 2r
距离,您还要做什么),但是它是否在任何地方有正式记录?
如果我可以依赖这种行为,那就太好了,这样我就不必手动计算 x 和 y 半径,而只需说明它们的比率。
All the docs I've seen for the ArcTo instruction for a SVG <path/>
's d
attribute give the first two arguments as the x and y radius of the arc.
Earlier, though, I was playing around, and in FF8 and Safari 5, it seemed like the path
<path d="M 100 100 A 50 50 0 0 0 200 100 Z"/>
and the path
<path d="M 100 100 A 1 1 0 0 0 200 100 Z"/>
rendered identically. From a bit more playing it seemed like what was really being used was the ratio between rx
and ry
. This makes sense (since what else are you going to do if the current position is more than 2r
away), but is it officially documented anywhere?
It'd be nice if I could rely on this behaviour so I didn't have to manually calculate the x and y radius and instead just state their ratio.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 SVG 规范:如果 rx、ry 导致无解(基本上,椭圆不够大,无法从 (x1, y1) 到达 (x2, y2)),则椭圆会均匀放大,直到出现恰好有一个解决方案(直到椭圆足够大)。
Per the SVG specification: If rx, ry are such that there is no solution (basically, the ellipse is not big enough to reach from (x1, y1) to (x2, y2)) then the ellipse is scaled up uniformly until there is exactly one solution (until the ellipse is just big enough).