SVGLength: valueInSpecifiedUnits 屬性
SVGLength 介面的 valueInSpecifiedUnits 屬性表示一個浮點數值,其單位由 unitType 指定。
設定此屬性將自動更新 value 和 valueAsString 以反映此設定。
值
長度的數值因子,以浮點數形式表示。
示例
js
// Get an SVGLength object
const svg = document.querySelector("svg");
const length = svg.createSVGLength();
// Set the value of the length
length.value = 10;
console.log(length.valueInSpecifiedUnits); // Output: 10
// Update the numeric factor of the length
length.valueInSpecifiedUnits = 20;
console.log(length.valueInSpecifiedUnits); // Output: 20
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGLength__valueInSpecifiedUnits |
瀏覽器相容性
載入中…