参考资料: http://www.w3school.com.cn/svg/index.asp
https://msdn.microsoft.com/zh-cn/library/gg193979
SVG 指可伸缩矢量图形。是使用 XML 来描述二维图形和绘图程序的语言。
SVG 代码的根元素是以 <svg> 元素开始,</svg>结束。width 和 height 属性可设置 SVG 文档的宽度和高度。version 属性可定义所使用的 SVG 版本,xmlns 属性可定义 SVG 命名空间。
<svg width="300px" height="300px" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="40" stroke="black" stroke-width="2" fill="#f60"/> </svg>
<svg width="300" height="300" version="1.2" xml:space="default"> <ellipse cx="100" cy="100" rx="50" ry="80" style="fill:#f60;stroke:#000;stroke-width:5;"/> </svg>
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="50" y="50" rx="20" ry="20" width="300" height="100" style="fill:rgb(0,0,255);fill-opacity:.5;stroke-width:2;stroke:#f60;stroke-opacity:.5;opacity:0.6" /> </svg>
<svg width="300" height="300" version="1.2" xml:space="default"> <line x1="50" y1="50" x2="200" y2="200" style="stroke:#f00;stroke-width:10"/> </svg>
<svg width="300" height="300" version="1.2" xml:space="default"> <polygon points="50,50 250,50 150,150" style="fill:#f60;stroke-width:5;stroke:#000;"/> </svg>
<svg width="300" height="300"> <polyline points="0,0 50,0 50,50 100,50 100,100 150,100 150,150" style="fill:#f60;stroke:#000;stroke-width:5"/> </svg>
<svg width="300" height="300" version="1.2" xml:space="default"> <path d="M0 0 L150 100 V200 H100 Z"/> </svg>
<svg width="500" height="500" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="Gaussian_Blur">
<feGaussianBlur in="SourceGraphic" stdDeviation="3" />
</filter>
</defs>
<circle cx="100" cy="100" r="40" stroke="black" stroke-width="2" fill="#f60" style="filter:url(#Gaussian_Blur);"/>
</svg>
SVG 中,可使用的滤镜如下:feBlend, feColorMatrix, feComponentTransfer, feComposite, feConvolveMatrix, feDiffuseLighting, feDisplacementMap, feFlood, feGaussianBlur, feImage, feMerge, feMorphology, feOffset, feSpecularLighting, feTile, feTurbulence, feDistantLight, fePointLight, feSpotLight
<svg width="800" height="800" version="1.2" xml:space="default"> <defs> <linearGradient id="orange_white" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:#f60;stop-opacity:1;"/> <stop offset="100%" style="stop-color:#fff;stop-opacity:1;"></stop> </linearGradient> <radialGradient id="orange_blue" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" style="stop-color:#f00;stop-opacity:1;"/> <stop offset="100%" style="stop-color:blue;stop-opacity:1;"/> </radialGradient> </defs> <rect height="200 " width="200" style="fill:url(#orange_white);stroke:#000;stroke-width:5;" /> <circle r="50" cx="300" cy="300" style="fill:url(#orange_blue)" />
<a xlink:href="http://www.jd.com" target="_blank"> <rect x="20" y="20" width="250" height="250" style="fill:blue;stroke:pink;stroke-width:5;opacity:0.9"/> </a>
<svg width="800" height="800"> <circle r="100" cx="200" cy="400" fill="#f60"> <animate attributeName="opacity" attributeType="CSS" from="1" to="0" dur="5s" repeatCount="indefinite"/> <animate attributeName="r" attributeType="XML" begin="0s" dur="5s" from="100" to="150" repeatCount="indefinite"/> <animateMotion path="M 0 0 L 100 100" dur="5s" fill="freeze" repeatCount="indefinite"/> </circle> <rect x="400" y="400" width="200" height="200" style="fill:#f00;"> <animateTransform attributeName="transform" attributeType="XML" type="rotate" from="-30" to="0" begin="1s" dur="5s" fill="freeze"/> <animateTransform attributeName="transform" attributeType="XML" type="scale" from="1" to="0.5" additive="sum" begin="1s" dur="5s" fill="freeze"/> </rect> </svg>
原文:http://www.cnblogs.com/zourong/p/6648393.html