SVGAnimatedNumberList: baseVal 属性

Baseline 已广泛支持

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

SVGAnimatedNumberList 接口的只读属性 baseVal 表示一个可动画的属性的非动画(基础)值,该属性接受一个 <number> 值列表。

此属性反映了 <svg> 元素的 viewBox 属性,feColorMatrix 元素的 values 属性,以及 <rect><polygon><polyline> 元素的 points 属性,作为只读的 SVGNumberList,提供对由 points 属性定义的静态点列表的访问。

一个表示属性基础值的 SVGNumberList 对象。该列表包含一个或多个数字,对应于属性中指定的单个数字值。

示例

js
const rect = document.querySelector("rect");

// Set the animatable 'points' attribute with number values
rect.setAttribute("points", "10,10 20,10 20,20 10,20");

// Access the SVGAnimatedNumberList object
const points = rect.points;

// Modify the base value
points.baseVal = [10, 15, 25, 30];

// Verify the reflected attribute value
console.log(rect.getAttribute("points")); // Output: "10,15 25,30"

规范

规范
Scalable Vector Graphics (SVG) 2
# __svg__SVGAnimatedNumberList__baseVal

浏览器兼容性

另见