SVGTextContentElement: getRotationOfChar() 方法
SVGTextContentElement 介面的 getRotationOfChar() 方法,表示一個排印字元的旋轉角度。
語法
js
getRotationOfChar(index)
引數
index-
一個
integer;字元的索引。
返回值
一個浮點數;字元的旋轉角度(以度為單位)。
異常
IndexSizeErrorDOMException-
如果
index處未找到字元,則丟擲異常。
示例
獲取字元的旋轉角度
html
<svg width="200" height="100">
<text id="exampleText" x="10" y="40" writing-mode="vertical-rl">
Hello, SVG
</text>
</svg>
js
const textElement = document.getElementById("exampleText");
// Get the rotation of the first character "H"
const rotation = textElement.getRotationOfChar(0);
console.log(extent); // Output: 90
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGTextContentElement__getRotationOfChar |
瀏覽器相容性
載入中…