SVG - Cercle

L'élément <circle> est utilisé pour dessiner un cercle avec un point central et un rayon donné.

Déclaration

Voici la déclaration de syntaxe de <circle>élément. Nous n'avons montré que les principaux attributs.

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

Les attributs

Sr.No. Nom et description
1 cx- coordonnée en abscisse du centre du cercle. La valeur par défaut est 0.
2 cy- coordonnée sur l'axe des y du centre du cercle. La valeur par défaut est 0.
3 r - rayon du cercle.

Exemple

testSVG.htm
<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>

Production

Ouvrez textSVG.htm dans le navigateur Web Chrome. Vous pouvez utiliser Chrome / Firefox / Opera pour afficher l'image SVG directement sans aucun plugin. Internet Explorer 9 et supérieur prend également en charge le rendu d'image SVG.

Cercle avec opacité

<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>

Production

Ouvrez textSVG.htm dans le navigateur Web Chrome. Vous pouvez utiliser Chrome / Firefox / Opera pour afficher l'image SVG directement sans aucun plugin. Internet Explorer 9 et supérieur prend également en charge le rendu d'image SVG.