SVGAnimatedRect: baseVal 屬性
SVGAnimatedRect 介面的只讀屬性 baseVal 表示 SVG 元素的 viewBox 屬性的當前非動畫值。
此屬性反映了 SVG 元素的 viewBox 屬性值,形式為一個只讀的 DOMRect 物件。它提供了對 viewBox 屬性定義的靜態矩形的訪問,包括 x、y、width 和 height 值。
值
一個表示 viewBox 屬性當前非動畫值的 DOMRect 物件。
示例
html
<svg viewBox="0 0 200 100" id="mySvg">
<rect width="100" height="100" fill="blue" />
</svg>
js
const svgElement = document.getElementById("mySvg");
const animatedRect = svgElement.viewBox.baseVal;
// Access the non-animated base value
console.log(animatedRect.x); // 0
console.log(animatedRect.y); // 0
console.log(animatedRect.width); // 200
console.log(animatedRect.height); // 100
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGAnimatedRect__baseVal |
瀏覽器相容性
載入中…