Generating a Gradient Checkerboard : pattern « SVG « XML






Generating a Gradient Checkerboard

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
 "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">

<svg width="800" height="400">
  <defs>
  <linearGradient id="gradientDefinition"
     x1="0" y1="0" x2="40" y2="40"
     gradientUnits="userSpaceOnUse">
     <stop offset="0%"   style="stop-color:#FF0000"/>
     <stop offset="100%" style="stop-color:#000000"/>
  </linearGradient>

  <pattern id="checkerPattern"
           width="40" height="40"
           patternUnits="userSpaceOnUse">

     <rect fill="url(#gradientDefinition)"
           stroke="yellow" stroke-dasharray="4 4 4 4"
           x="0" y="0" width="40" height="40"/>
  </pattern>
  </defs>

  <rect
     fill="url(#checkerPattern)"
     style="stroke:red"
     x="0" y="0" width="800" height="400"/>
</svg>

 








Related examples in the same category

1.Using an SVG pattern Element
2.Generating a Checkerboard Grid