SVGCircleElement: cx プロパティ
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
cx は SVGCircleElement インターフェイスの読み取り専用プロパティで、<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);
仕様書
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2> # __svg__SVGCircleElement__cx> |