Svg-circle

提供:Dev Guides
移動先:案内検索

SVG-サークル

<circle>要素は、中心点と指定された半径の円を描くために使用されます。

宣言

以下は、 <circle> 要素の構文宣言です。 主な属性のみを示しました。

<circle
   cx="x-axis co-ordinate"
   cy="y-axis co-ordinate"
   r="length" >
</circle>

属性

Sr.No. Name & Description
1 cx − x-axis co-ordinate of the center of the circle. Default is 0.
2 cy − y-axis co-ordinate of the center of the circle. Default is 0.
3 r − radius of the circle.

テストVG

<html>
   <title>SVG Circle</title>
   <body>

      <h1>Sample SVG Circle Image</h1>

      <svg width="800" height="800">
         <g>
            <text x="0" y="15" fill="black" >Circle #1: Without opacity.</text>
            <circle cx="100" cy="100" r="50" stroke="black"
            stroke-width="3" fill="rgb(121,0,121)"></circle>
         </g>
      </svg>

   </body>
</html>

出力

ChromeウェブブラウザでテキストSVGを開きます。 Chrome/Firefox/Operaを使用して、プラグインなしでSVG画像を直接表示できます。 Internet Explorer 9以降もSVG画像レンダリングをサポートしています。

不透明な円

<html>
   <title>SVG Circle</title>
   <body>

      <h1>Sample SVG Circle Image</h1>

      <svg width="800" height="800">
         <g>
            <text x="0" y="15" fill="black" >Circle #2: With opacity </text>
            <circle cx="100" cy="100" r="50"
            style="fill:rgb(121,0,121);stroke-width:3;
            stroke:rgb(0,0,0);stroke-opacity:0.5;opacity:0.5"> </circle>
         </g>
      </svg>

   </body>
</html>

出力

ChromeウェブブラウザでテキストSVGを開きます。 Chrome/Firefox/Operaを使用して、プラグインなしでSVG画像を直接表示できます。 Internet Explorer 9以降もSVG画像レンダリングをサポートしています。