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

浏览器兼容性

另见