SVGCircleElement: cx 属性
SVGCircleElement 接口的只读属性 cx 反映了 <circle> 元素的 cx 属性,并由此定义了圆心的 x 坐标。
如果未指定,则效果如同将值设置为 0。
值
一个 SVGAnimatedLength 对象,表示圆心的 x 坐标。
示例
SVG
html
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
width="200"
height="200">
<circle cx="50" cy="50" r="50" fill="gold" id="circle" />
</svg>
JavaScript
js
const circle = document.getElementById("circle");
console.log(circle.cx);
规范
| 规范 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGCircleElement__cx |
浏览器兼容性
加载中…