【问题标题】:What is the first and last number in the points attribute for an svg polygon?svg 多边形的点属性中的第一个和最后一个数字是多少?
【发布时间】:2017-07-23 11:23:10
【问题描述】:

我试图理解点属性中的第一个和最后一个数字值代表什么,但 MDN 似乎没有解释这一点,它实际上说需要有两个数字,但是我一直看到第一个和最后一个模式.我一直注意到有成对的数字,代表点的 x 和 y 轴的值,但是它们只是一个数字,在开头和结尾不是一对?

<svg height="210" width="500">
   <polygon points="100,10 40,198 190,78 10,78 160,198">//what does first and last number mean?
   <style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;" />
</svg>

【问题讨论】:

  • 点是多边形的顶点。他们还会是什么?

标签: svg polygons


【解决方案1】:

您误解了数字及其分隔符。

points 值中,如下所示:

100,10 40,198 190,78 10,78 160,198

X 和 Y 坐标用逗号分隔, 用空格分隔(但这里也允许使用逗号)。

所以有五个 X,Y 坐标对:(100,10) (40,198) (190,78) (10,78) 和 (160,198)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-04-11
    • 1970-01-01
    • 2022-06-22
    • 2016-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多