SVGAnimatedNumberList: animVal 屬性

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2015 年 7 月⁩以來,各瀏覽器均已提供此特性。

SVGAnimatedNumberList 介面的只讀屬性 animVal 表示可動畫屬性的當前動畫值,該屬性接受一個 <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;

console.dir(points.animVal); // the animated state

規範

規範
Scalable Vector Graphics (SVG) 2
# __svg__SVGAnimatedNumberList__animVal

瀏覽器相容性

另見