Multi-Stop Radial Gradients : radialGradient « SVG « XML






Multi-Stop Radial Gradients

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

<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">

  <defs>
    <radialGradient id="radialGradient1"
      gradientUnits="userSpaceOnUse" cx="400" cy="200" r="300" fx="400"
      fy="200">
      <stop offset="0%" stop-color="yellow" />
      <stop offset="67%" stop-color="red" />
      <stop offset="100%" stop-color="blue" />
    </radialGradient>

    <radialGradient id="radialGradient2"
      gradientUnits="userSpaceOnUse" cx="400" cy="200" r="300" fx="400"
      fy="200">
      <stop offset="0%" stop-color="yellow" />
      <stop offset="33%" stop-color="blue" />
      <stop offset="100%" stop-color="red" />
    </radialGradient>
  </defs>

  <g transform="translate(50,20)">
    <ellipse fill="url(#radialGradient1)" stroke="black"
      stroke-width="8" cx="300" cy="100" rx="300" ry="100" />

    <rect fill="url(#radialGradient2)" stroke="black"
      stroke-width="8" x="0" y="200" width="600" height="300" />
  </g>
</svg>

 








Related examples in the same category

1.Rendering Rectangles with Radial Gradients
2.Creating 3D Effects with Circles