SVGAnimatedInteger: baseVal 屬性

Baseline 已廣泛支援

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

SVGAnimatedInteger 介面的 baseVal 屬性表示可動畫化的 <integer> 的基礎(非動畫)值。

某些屬性,例如 <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 base value
console.log(animatedInteger.baseVal); // Output: 4

// Modify the base value
animatedInteger.baseVal = 6;

// Verify the reflected attribute value
console.log(feTurbulence.getAttribute("numOctaves")); // Output: "6"

規範

規範
Scalable Vector Graphics (SVG) 2
# __svg__SVGAnimatedInteger__baseVal

瀏覽器相容性

另見