SVGAnimatedInteger: animVal 屬性

Baseline 已廣泛支援

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

SVGAnimatedInteger 介面的 animVal 屬性表示一個 <integer> 的動畫值。如果沒有應用動畫,animVal 等於 baseVal

某些屬性,例如 <feTurbulence> 元素的 numOctaves 屬性或 <feConvolveMatrix> 元素的 order 屬性,接受一個 long 整數作為值。此屬性提供了對屬性當前動畫狀態的數字訪問。

一個 long;該屬性的動畫值。

示例

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

// Set the animatable 'numOctaves' attribute
feTurbulence.setAttribute("numOctaves", "4");

// Access the SVGAnimatedInteger object
const animatedInteger = feTurbulence.numOctaves;

// Get the animated value (read-only)
console.log(animatedInteger.animVal); // Output: 4 (the current animated value)

規範

規範
Scalable Vector Graphics (SVG) 2
# __svg__SVGAnimatedInteger__animVal

瀏覽器相容性

另見