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 |
浏览器兼容性
加载中…