实例属性
SVGPointList.length只读-
返回列表中点的数量。
SVGPointList.numberOfItems只读-
返回列表中点的数量。
实例方法
SVGPointList.clear()-
移除列表中的所有项。
SVGPointList.initialize()-
首先移除列表中的所有项,然后向列表中添加单个值。
SVGPointList.getItem()-
获取列表中指定位置的项。
SVGPointList.insertItemBefore()-
在指定位置将元素插入列表。
SVGPointList.replaceItem()-
用新项替换列表中的一项。
SVGPointList.removeItem()-
从列表中移除一项。
SVGPointList.appendItem()-
将一项添加到列表末尾。
示例
以下示例显示了一个包含具有五个坐标对的 <polyline> 的 SVG。points 属性返回一个 SVGPointList。
html
<svg viewBox="-10 -10 120 120" xmlns="http://www.w3.org/2000/svg">
<polyline
id="example"
stroke="black"
fill="none"
points="50,0 21,90 98,35 2,35 79,90" />
</svg>
js
const example = document.getElementById("example");
console.log(example.points); // An SVGPointList
规范
| 规范 |
|---|
| Scalable Vector Graphics (SVG) 2 # 接口SVGPointList |
浏览器兼容性
加载中…