SVGAnimatedInteger: baseVal プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

baseValSVGAnimatedInteger インターフェイスの読み取り専用プロパティで、 SVG 要素に関連付けられた <integer> の(アニメーションしていない)基底値を表します。

<feTurbulence> 要素の numOctaves 属性や、 <feConvolveMatrix> 要素の order 属性のように、 long 型の整数を値として受け入れる属性もあります。このプロパティで、属性の静的なアニメーション中ではない状態に数値としてアクセスできます。

long 型です。属性を反映したアニメーション中ではない値です。

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

// アニメーション可能な 'numOctaves' 属性を設定
feTurbulence.setAttribute("numOctaves", "4");

// SVGAnimatedInteger オブジェクトにアクセス
const animatedInteger = feTurbulence.numOctaves;

// 基底値を取得
console.log(animatedInteger.baseVal); // 出力: 4

// 基底値を変更
animatedInteger.baseVal = 6;

// 反映された属性の値を検証
console.log(feTurbulence.getAttribute("numOctaves")); // 出力: "6"

仕様書

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGAnimatedInteger__baseVal

ブラウザーの互換性

関連情報