SVGPolylineElement: animatedPoints 属性

Baseline 已广泛支持

此特性已相当成熟,可在许多设备和浏览器版本上使用。自 ⁨2015 年 7 月⁩以来,各浏览器均已提供此特性。

SVGPolylineElement 接口的只读属性 animatedPoints 反映了元素 points 属性的动画值。如果 points 属性未被动画化,它包含的值与 points 属性相同。

一个 SVGPointList 对象。

示例

访问 animatedPoints 属性

html
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200">
  <polyline
    id="myPolyline"
    points="100,10 150,50 100,90 50,50"
    fill="none"
    stroke="blue"
    stroke-width="4">
    <animate
      attributeName="points"
      values="100,10 150,50 100,90 50,50; 150,10 200,50 150,90 100,50"
      dur="2s"
      repeatCount="indefinite" />
  </polyline>
</svg>
js
const polylineElement = document.getElementById("myPolyline");

// Access the animatedPoints property
console.dir(polylineElement.animatedPoints); // Output: SVGPointList object

规范

规范
Scalable Vector Graphics (SVG) 2
# __svg__SVGAnimatedPoints__animatedPoints

浏览器兼容性