SVGCircleElement: r プロパティ
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月.
r は SVGCircleElement インターフェイスの読み取り専用プロパティで、<circle> 要素の r 属性を反映し、この円の半径を定義します。
指定されなかった場合は、0 が設定されたかのような効果になります。
値
SVGAnimatedLength で、この円の半径を表します。
例
>SVG
html
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
width="200"
height="200">
<circle r="50" fill="gold" id="circle" />
</svg>
JavaScript
js
const circle = document.getElementById("circle");
console.log(circle.r);
仕様書
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2> # __svg__SVGCircleElement__r> |