SVGLength: value 屬性
SVGLength 介面的 value 屬性代表使用者單位中 <length> 的浮點值。
設定此屬性將自動更新 SVGLength.valueInSpecifiedUnits 和 SVGLength.valueAsString 以反映此設定。
值
使用者單位中的長度值,以浮點數表示。
示例
js
// Get an SVGLength object
const svg = document.querySelector("svg");
const length = svg.createSVGLength();
// Set the value
length.value = 10;
console.log(length.value); // Output: 10
// Reflecting the value
length.value = 20;
console.log(length.value); // Output: 20
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGLength__value |
瀏覽器相容性
載入中…