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

浏览器兼容性

另见