Sunday, March 22, 2015

Patterns in SVG

Patterns can be developed in SVG or they can be made from SVG images or SVG shapes. However these patterns can also be made from bitmap images, the structure of SVG patterns are like tiles that are made in Photoshop. These patterns are mainly used to fill the shapes , these patterns made with images are used to fill those shapes in SVG.An element called the circle element is used as a fill pattern in the SVG.    

Example:


 <!DOCTYPE html>  
 <html>  
 <head lang="en">  
   <meta charset="UTF-8">  
   <title>Nirajan Ghimirey’s Workshop</title>  
 </head>  
 <body>  
 <h2>Pattern Example</h2>  
 <svg width="120" height="120" viewBox="0 0 120 120">  
   <defs>  
     <pattern id="Triangle"  
          width="10" height="10"  
          patternUnits="userSpaceOnUse">  
       <polygon points="5,0 10,10 0,10"/>  
     </pattern>  
   </defs>  
   <circle cx="60" cy="60" r="50"  
       fill="url(#Triangle)"/>  
 </svg>  
 </body>  
 </html>


No comments:

Post a Comment