SVGTextPositioningElement:rotate 屬性
SVGTextPositioningElement 介面的只讀屬性 rotate 反映了單個文字字形的旋轉,該旋轉由給定元素的 rotate 屬性指定。
值
一個 SVGAnimatedNumberList 物件。
示例
給定以下 SVG
html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<text x="10" y="20" rotate="45">Hello</text>
<text x="50" y="50" rotate="90">World</text>
</svg>
我們可以訪問 rotate 屬性
js
const texts = document.querySelectorAll("text");
console.log(texts[0].rotate.baseVal); // output: 45
console.log(texts[1].rotate.baseVal); // output: 90
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGTextPositioningElement__rotate |
瀏覽器相容性
載入中…