このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

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月⁩.

rSVGCircleElement インターフェイスの読み取り専用プロパティで、<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

ブラウザーの互換性

関連情報