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

View in English Always switch to English

r

Baseline
広く利用可能

この機能は広く実装されており、多くのバージョンの端末やブラウザーで動作します。2015年7月以降、すべてのブラウザーで利用可能です。

r 属性は円の半径を定義します。

この属性は次の SVG 要素で使用できます。

パーセント値は、現在の SVG ビューポートの正規化された対角線に対する割合です。これは、 <width>2+<height>22 で計算されたものです。

circle

<circle> において、r は円の半径を定義し、その大きさを決定します。ゼロ以下の値を指定すると、円は描画されません。

値 <length> | <percentage>
デフォルト値 0
アニメーション 可

メモ: <circle> の半径の大きさは、幾何プロパティ r で定義することもできます。

radialGradient

<radialGradient> において、r は放射グラデーションの末端の円の半径を定義します。

グラデーションは、100% の色経由点がこの末端の円の外周に対応するように描画されます。ゼロ以下の値を指定すると、最後のグラデーションの <stop> の色と不透明度を使用した単一の色で領域が塗りつぶされます。

値 <length>
デフォルト値 50%
アニメーション 可

例

html
<svg viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
  <radialGradient r="0" id="myGradient000">
    <stop offset="0" stop-color="white" />
    <stop offset="100%" stop-color="black" />
  </radialGradient>
  <radialGradient r="50%" id="myGradient050">
    <stop offset="0" stop-color="white" />
    <stop offset="100%" stop-color="black" />
  </radialGradient>
  <radialGradient r="100%" id="myGradient100">
    <stop offset="0" stop-color="white" />
    <stop offset="100%" stop-color="black" />
  </radialGradient>

  <circle cx="50" cy="50" r="0" />
  <circle cx="150" cy="50" r="25" />
  <circle cx="250" cy="50" r="50" />

  <rect x="20" y="120" width="60" height="60" fill="url(#myGradient000)" />
  <rect x="120" y="120" width="60" height="60" fill="url(#myGradient050)" />
  <rect x="220" y="120" width="60" height="60" fill="url(#myGradient100)" />
</svg>

仕様書

仕様書
Scalable Vector Graphics (SVG) 2
# RProperty
Scalable Vector Graphics (SVG) 2
# RadialGradientElementRAttribute

ブラウザーの互換性

svg.elements.circle.r

svg.elements.radialGradient.r

関連情報

  • CSS の r プロパティ