{"id":2964,"date":"2018-08-07T08:51:27","date_gmt":"2018-08-07T00:51:27","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2964"},"modified":"2018-08-07T08:51:27","modified_gmt":"2018-08-07T00:51:27","slug":"svg-%e5%9b%be%e5%83%8f%e5%85%a5%e9%97%a8%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2964","title":{"rendered":"SVG \u56fe\u50cf\u5165\u95e8\u6559\u7a0b"},"content":{"rendered":"<h2>\n\t\u4e00\u3001\u6982\u8ff0<br \/>\n<\/h2>\n<p>\n\tSVG \u662f\u4e00\u79cd\u57fa\u4e8e XML \u8bed\u6cd5\u7684\u56fe\u50cf\u683c\u5f0f\uff0c\u5168\u79f0\u662f\u53ef\u7f29\u653e\u77e2\u91cf\u56fe\uff08Scalable Vector Graphics\uff09\u3002\u5176\u4ed6\u56fe\u50cf\u683c\u5f0f\u90fd\u662f\u57fa\u4e8e\u50cf\u7d20\u5904\u7406\u7684\uff0cSVG \u5219\u662f\u5c5e\u4e8e\u5bf9\u56fe\u50cf\u7684\u5f62\u72b6\u63cf\u8ff0\uff0c\u6240\u4ee5\u5b83\u672c\u8d28\u4e0a\u662f\u6587\u672c\u6587\u4ef6\uff0c\u4f53\u79ef\u8f83\u5c0f\uff0c\u4e14\u4e0d\u7ba1\u653e\u5927\u591a\u5c11\u500d\u90fd\u4e0d\u4f1a\u5931\u771f\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wangbase.com\/blogimg\/asset\/201808\/bg2018080601.jpg\" title=\"\" \/>\n<\/p>\n<p>\n\tSVG \u6587\u4ef6\u53ef\u4ee5\u76f4\u63a5\u63d2\u5165\u7f51\u9875\uff0c\u6210\u4e3a DOM \u7684\u4e00\u90e8\u5206\uff0c\u7136\u540e\u7528 JavaScript \u548c CSS \u8fdb\u884c\u64cd\u4f5c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;svg\r\n  id=&quot;mysvg&quot;\r\n  xmlns=&quot;<a href=\"http:\/\/www.w3.org\/2000\/svg\">http:\/\/www.w3.org\/2000\/svg<\/a>&quot;\r\n  viewBox=&quot;0 0 800 600&quot;\r\n  preserveAspectRatio=&quot;xMidYMid meet&quot;\r\n&gt;\r\n  &lt;circle id=&quot;mycircle&quot; cx=&quot;400&quot; cy=&quot;300&quot; r=&quot;50&quot; \/&gt;\r\n&lt;svg&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u662f SVG \u4ee3\u7801\u76f4\u63a5\u63d2\u5165\u7f51\u9875\u7684\u4f8b\u5b50\u3002\n<\/p>\n<p>\n\tSVG \u4ee3\u7801\u4e5f\u53ef\u4ee5\u5199\u5728\u4e00\u4e2a\u72ec\u7acb\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u7528<code>&lt;img&gt;<\/code>\u3001<code>&lt;object&gt;<\/code>\u3001<code>&lt;embed&gt;<\/code>\u3001<code>&lt;iframe&gt;<\/code>\u7b49\u6807\u7b7e\u63d2\u5165\u7f51\u9875\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;img src=&quot;circle.svg&quot;&gt;\r\n&lt;object id=&quot;object&quot; data=&quot;circle.svg&quot; type=&quot;image\/svg+xml&quot;&gt;&lt;\/object&gt;\r\n&lt;embed id=&quot;embed&quot; src=&quot;icon.svg&quot; type=&quot;image\/svg+xml&quot;&gt;\r\n&lt;iframe id=&quot;iframe&quot; src=&quot;icon.svg&quot;&gt;&lt;\/iframe&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\tCSS \u4e5f\u53ef\u4ee5\u4f7f\u7528 SVG \u6587\u4ef6\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n.logo {\r\n  background: url(icon.svg);\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\tSVG \u6587\u4ef6\u8fd8\u53ef\u4ee5\u8f6c\u4e3a BASE64 \u7f16\u7801\uff0c\u7136\u540e\u4f5c\u4e3a Data URI \u5199\u5165\u7f51\u9875\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;img src=&quot;data:image\/svg+xml;base64,[data]&quot;&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<h2>\n\t\u4e8c\u3001\u8bed\u6cd5<br \/>\n<\/h2>\n<h3>\n\t2.1&nbsp;<code>&lt;svg&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\tSVG \u4ee3\u7801\u90fd\u653e\u5728\u9876\u5c42\u6807\u7b7e<code>&lt;svg&gt;<\/code>\u4e4b\u4e2d\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;100%&quot; height=&quot;100%&quot;&gt;\r\n  &lt;circle id=&quot;mycircle&quot; cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;50&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;svg&gt;<\/code>\u7684<code>width<\/code>\u5c5e\u6027\u548c<code>height<\/code>\u5c5e\u6027\uff0c\u6307\u5b9a\u4e86 SVG \u56fe\u50cf\u5728 HTML \u5143\u7d20\u4e2d\u6240\u5360\u636e\u7684\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u3002\u9664\u4e86\u76f8\u5bf9\u5355\u4f4d\uff0c\u4e5f\u53ef\u4ee5\u91c7\u7528\u7edd\u5bf9\u5355\u4f4d\uff08\u5355\u4f4d\uff1a\u50cf\u7d20\uff09\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u8fd9\u4e24\u4e2a\u5c5e\u6027\uff0cSVG \u56fe\u50cf\u9ed8\u8ba4\u5927\u5c0f\u662f300\u50cf\u7d20\uff08\u5bbd\uff09 x 150\u50cf\u7d20\uff08\u9ad8\uff09\u3002\n<\/p>\n<p>\n\t\u5982\u679c\u53ea\u60f3\u5c55\u793a SVG \u56fe\u50cf\u7684\u4e00\u90e8\u5206\uff0c\u5c31\u8981\u6307\u5b9a<code>viewBox<\/code>\u5c5e\u6027\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;100&quot; height=&quot;100&quot; viewBox=&quot;50 50 50 50&quot;&gt;\r\n  &lt;circle id=&quot;mycircle&quot; cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;50&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;viewBox&gt;<\/code>\u5c5e\u6027\u7684\u503c\u6709\u56db\u4e2a\u6570\u5b57\uff0c\u5206\u522b\u662f\u5de6\u4e0a\u89d2\u7684\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\u3001\u89c6\u53e3\u7684\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u3002\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0cSVG \u56fe\u50cf\u662f100\u50cf\u7d20\u5bbd x 100\u50cf\u7d20\u9ad8\uff0c<code>viewBox<\/code>\u5c5e\u6027\u6307\u5b9a\u89c6\u53e3\u4ece<code>(50, 50)<\/code>\u8fd9\u4e2a\u70b9\u5f00\u59cb\u3002\u6240\u4ee5\uff0c\u5b9e\u9645\u770b\u5230\u7684\u662f\u53f3\u4e0b\u89d2\u7684\u56db\u5206\u4e4b\u4e00\u5706\u3002\n<\/p>\n<p>\n\t\u6ce8\u610f\uff0c\u89c6\u53e3\u5fc5\u987b\u9002\u914d\u6240\u5728\u7684\u7a7a\u95f4\u3002\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u89c6\u53e3\u7684\u5927\u5c0f\u662f 50 x 50\uff0c\u7531\u4e8e SVG \u56fe\u50cf\u7684\u5927\u5c0f\u662f 100 x 100\uff0c\u6240\u4ee5\u89c6\u53e3\u4f1a\u653e\u5927\u53bb\u9002\u914d SVG \u56fe\u50cf\u7684\u5927\u5c0f\uff0c\u5373\u653e\u5927\u4e86\u56db\u500d\u3002\n<\/p>\n<p>\n\t\u5982\u679c\u4e0d\u6307\u5b9a<code>width<\/code>\u5c5e\u6027\u548c<code>height<\/code>\u5c5e\u6027\uff0c\u53ea\u6307\u5b9a<code>viewBox<\/code>\u5c5e\u6027\uff0c\u5219\u76f8\u5f53\u4e8e\u53ea\u7ed9\u5b9a SVG \u56fe\u50cf\u7684\u957f\u5bbd\u6bd4\u3002\u8fd9\u65f6\uff0cSVG \u56fe\u50cf\u7684\u9ed8\u8ba4\u5927\u5c0f\u5c06\u7b49\u4e8e\u6240\u5728\u7684 HTML \u5143\u7d20\u7684\u5927\u5c0f\u3002\n<\/p>\n<h3>\n\t2.2&nbsp;<code>&lt;circle&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;circle&gt;<\/code>\u6807\u7b7e\u4ee3\u8868\u5706\u5f62\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n  &lt;circle cx=&quot;30&quot;  cy=&quot;50&quot; r=&quot;25&quot; \/&gt;\r\n  &lt;circle cx=&quot;90&quot;  cy=&quot;50&quot; r=&quot;25&quot; class=&quot;red&quot; \/&gt;\r\n  &lt;circle cx=&quot;150&quot; cy=&quot;50&quot; r=&quot;25&quot; class=&quot;fancy&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u7684\u4ee3\u7801\u5b9a\u4e49\u4e86\u4e09\u4e2a\u5706\u3002<code>&lt;circle&gt;<\/code>\u6807\u7b7e\u7684<code>cx<\/code>\u3001<code>cy<\/code>\u3001<code>r<\/code>\u5c5e\u6027\u5206\u522b\u4e3a\u6a2a\u5750\u6807\u3001\u7eb5\u5750\u6807\u548c\u534a\u5f84\uff0c\u5355\u4f4d\u4e3a\u50cf\u7d20\u3002\u5750\u6807\u90fd\u662f\u76f8\u5bf9\u4e8e<code>&lt;svg&gt;<\/code>\u753b\u5e03\u7684\u5de6\u4e0a\u89d2\u539f\u70b9\u3002\n<\/p>\n<p>\n\t<code>class<\/code>\u5c5e\u6027\u7528\u6765\u6307\u5b9a\u5bf9\u5e94\u7684 CSS \u7c7b\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n.red {\r\n  fill: red;\r\n}\r\n\r\n.fancy {\r\n  fill: none;\r\n  stroke: black;\r\n  stroke-width: 3pt;\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\tSVG \u7684 CSS \u5c5e\u6027\u4e0e\u7f51\u9875\u5143\u7d20\u6709\u6240\u4e0d\u540c\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\tfill\uff1a\u586b\u5145\u8272\n\t\t<\/li>\n<li>\n\t\t\tstroke\uff1a\u63cf\u8fb9\u8272\n\t\t<\/li>\n<li>\n\t\t\tstroke-width\uff1a\u8fb9\u6846\u5bbd\u5ea6\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<h3>\n\t2.3&nbsp;<code>&lt;line&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;line&gt;<\/code>\u6807\u7b7e\u7528\u6765\u7ed8\u5236\u76f4\u7ebf\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n  &lt;line x1=&quot;0&quot; y1=&quot;0&quot; x2=&quot;200&quot; y2=&quot;0&quot; style=&quot;stroke:rgb(0,0,0);stroke-width:5&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c<code>&lt;line&gt;<\/code>\u6807\u7b7e\u7684<code>x1<\/code>\u5c5e\u6027\u548c<code>y1<\/code>\u5c5e\u6027\uff0c\u8868\u793a\u7ebf\u6bb5\u8d77\u70b9\u7684\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\uff1b<code>x2<\/code>\u5c5e\u6027\u548c<code>y2<\/code>\u5c5e\u6027\uff0c\u8868\u793a\u7ebf\u6bb5\u7ec8\u70b9\u7684\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\uff1b<code>style<\/code>\u5c5e\u6027\u8868\u793a\u7ebf\u6bb5\u7684\u6837\u5f0f\u3002\n<\/p>\n<h3>\n\t2.4&nbsp;<code>&lt;polyline&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;polyline&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u7ed8\u5236\u4e00\u6839\u6298\u7ebf\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n  &lt;polyline points=&quot;3,3 30,28 3,53&quot; fill=&quot;none&quot; stroke=&quot;black&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;polyline&gt;<\/code>\u7684<code>points<\/code>\u5c5e\u6027\u6307\u5b9a\u4e86\u6bcf\u4e2a\u7aef\u70b9\u7684\u5750\u6807\uff0c\u6a2a\u5750\u6807\u4e0e\u7eb5\u5750\u6807\u4e4b\u95f4\u4e0e\u9017\u53f7\u5206\u9694\uff0c\u70b9\u4e0e\u70b9\u4e4b\u95f4\u7528\u7a7a\u683c\u5206\u9694\u3002\n<\/p>\n<h3>\n\t2.5&nbsp;<code>&lt;rect&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;rect&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u7ed8\u5236\u77e9\u5f62\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n  &lt;rect x=&quot;0&quot; y=&quot;0&quot; height=&quot;100&quot; width=&quot;200&quot; style=&quot;stroke: #70d5dd; fill: #dd524b&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;rect&gt;<\/code>\u7684<code>x<\/code>\u5c5e\u6027\u548c<code>y<\/code>\u5c5e\u6027\uff0c\u6307\u5b9a\u4e86\u77e9\u5f62\u5de6\u4e0a\u89d2\u7aef\u70b9\u7684\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\uff1b<code>width<\/code>\u5c5e\u6027\u548c<code>height<\/code>\u5c5e\u6027\u6307\u5b9a\u4e86\u77e9\u5f62\u7684\u5bbd\u5ea6\u548c\u9ad8\u5ea6\uff08\u5355\u4f4d\u50cf\u7d20\uff09\u3002\n<\/p>\n<h3>\n\t2.6&nbsp;<code>&lt;ellipse&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;ellipse&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u7ed8\u5236\u692d\u5706\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n  &lt;ellipse cx=&quot;60&quot; cy=&quot;60&quot; ry=&quot;40&quot; rx=&quot;20&quot; stroke=&quot;black&quot; stroke-width=&quot;5&quot; fill=&quot;silver&quot;\/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;ellipse&gt;<\/code>\u7684<code>cx<\/code>\u5c5e\u6027\u548c<code>cy<\/code>\u5c5e\u6027\uff0c\u6307\u5b9a\u4e86\u692d\u5706\u4e2d\u5fc3\u7684\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\uff08\u5355\u4f4d\u50cf\u7d20\uff09\uff1b<code>rx<\/code>\u5c5e\u6027\u548c<code>ry<\/code>\u5c5e\u6027\uff0c\u6307\u5b9a\u4e86\u692d\u5706\u6a2a\u5411\u8f74\u548c\u7eb5\u5411\u8f74\u7684\u534a\u5f84\uff08\u5355\u4f4d\u50cf\u7d20\uff09\u3002\n<\/p>\n<h3>\n\t2.7&nbsp;<code>&lt;polygon&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;polygon&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u7ed8\u5236\u591a\u8fb9\u5f62\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n  &lt;polygon fill=&quot;green&quot; stroke=&quot;orange&quot; stroke-width=&quot;1&quot; points=&quot;0,0 100,0 100,100 0,100 0,0&quot;\/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;polygon&gt;<\/code>\u7684<code>points<\/code>\u5c5e\u6027\u6307\u5b9a\u4e86\u6bcf\u4e2a\u7aef\u70b9\u7684\u5750\u6807\uff0c\u6a2a\u5750\u6807\u4e0e\u7eb5\u5750\u6807\u4e4b\u95f4\u4e0e\u9017\u53f7\u5206\u9694\uff0c\u70b9\u4e0e\u70b9\u4e4b\u95f4\u7528\u7a7a\u683c\u5206\u9694\u3002\n<\/p>\n<h3>\n\t2.8&nbsp;<code>&lt;path&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;path&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u5236\u8def\u5f84\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n&lt;path d=&quot;\r\n  M 18,3\r\n  L 46,3\r\n  L 46,40\r\n  L 61,40\r\n  L 32,68\r\n  L 3,40\r\n  L 18,40\r\n  Z\r\n&quot;&gt;&lt;\/path&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;path&gt;<\/code>\u7684<code>d<\/code>\u5c5e\u6027\u8868\u793a\u7ed8\u5236\u987a\u5e8f\uff0c\u5b83\u7684\u503c\u662f\u4e00\u4e2a\u957f\u5b57\u7b26\u4e32\uff0c\u6bcf\u4e2a\u5b57\u6bcd\u8868\u793a\u4e00\u4e2a\u7ed8\u5236\u52a8\u4f5c\uff0c\u540e\u9762\u8ddf\u7740\u5750\u6807\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\tM\uff1a\u79fb\u52a8\u5230\uff08moveto\uff09\n\t\t<\/li>\n<li>\n\t\t\tL\uff1a\u753b\u76f4\u7ebf\u5230\uff08lineto\uff09\n\t\t<\/li>\n<li>\n\t\t\tZ\uff1a\u95ed\u5408\u8def\u5f84\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<h3>\n\t2.9&nbsp;<code>&lt;text&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;text&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u7ed8\u5236\u6587\u672c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;180&quot;&gt;\r\n  &lt;text x=&quot;50&quot; y=&quot;25&quot;&gt;Hello World&lt;\/text&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;text&gt;<\/code>\u7684<code>x<\/code>\u5c5e\u6027\u548c<code>y<\/code>\u5c5e\u6027\uff0c\u8868\u793a\u6587\u672c\u533a\u5757\u57fa\u7ebf\uff08baseline\uff09\u8d77\u70b9\u7684\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\u3002\u6587\u5b57\u7684\u6837\u5f0f\u53ef\u4ee5\u7528<code>class<\/code>\u6216<code>style<\/code>\u5c5e\u6027\u6307\u5b9a\u3002\n<\/p>\n<h3>\n\t2.10&nbsp;<code>&lt;use&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;use&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u590d\u5236\u4e00\u4e2a\u5f62\u72b6\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg viewBox=&quot;0 0 30 10&quot; xmlns=&quot;<a href=\"http:\/\/www.w3.org\/2000\/svg\">http:\/\/www.w3.org\/2000\/svg<\/a>&quot;&gt;\r\n  &lt;circle id=&quot;myCircle&quot; cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;4&quot;\/&gt;\r\n\r\n  &lt;use href=&quot;#myCircle&quot; x=&quot;10&quot; y=&quot;0&quot; fill=&quot;blue&quot; \/&gt;\r\n  &lt;use href=&quot;#myCircle&quot; x=&quot;20&quot; y=&quot;0&quot; fill=&quot;white&quot; stroke=&quot;blue&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t<code>&lt;use&gt;<\/code>\u7684<code>href<\/code>\u5c5e\u6027\u6307\u5b9a\u6240\u8981\u590d\u5236\u7684\u8282\u70b9\uff0c<code>x<\/code>\u5c5e\u6027\u548c<code>y<\/code>\u5c5e\u6027\u662f<code>&lt;use&gt;<\/code>\u5de6\u4e0a\u89d2\u7684\u5750\u6807\u3002\u53e6\u5916\uff0c\u8fd8\u53ef\u4ee5\u6307\u5b9a<code>width<\/code>\u548c<code>height<\/code>\u5750\u6807\u3002\n<\/p>\n<h3>\n\t2.11&nbsp;<code>&lt;g&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;g&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u5c06\u591a\u4e2a\u5f62\u72b6\u7ec4\u6210\u4e00\u4e2a\u7ec4\uff08group\uff09\uff0c\u65b9\u4fbf\u590d\u7528\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;100&quot;&gt;\r\n  &lt;g id=&quot;myCircle&quot;&gt;\r\n    &lt;text x=&quot;25&quot; y=&quot;20&quot;&gt;\u5706\u5f62&lt;\/text&gt;\r\n    &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;20&quot;\/&gt;\r\n  &lt;\/g&gt;\r\n\r\n  &lt;use href=&quot;#myCircle&quot; x=&quot;100&quot; y=&quot;0&quot; fill=&quot;blue&quot; \/&gt;\r\n  &lt;use href=&quot;#myCircle&quot; x=&quot;200&quot; y=&quot;0&quot; fill=&quot;white&quot; stroke=&quot;blue&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t2.12&nbsp;<code>&lt;defs&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;defs&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u81ea\u5b9a\u4e49\u5f62\u72b6\uff0c\u5b83\u5185\u90e8\u7684\u4ee3\u7801\u4e0d\u4f1a\u663e\u793a\uff0c\u4ec5\u4f9b\u5f15\u7528\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;300&quot; height=&quot;100&quot;&gt;\r\n  &lt;defs&gt;\r\n    &lt;g id=&quot;myCircle&quot;&gt;\r\n      &lt;text x=&quot;25&quot; y=&quot;20&quot;&gt;\u5706\u5f62&lt;\/text&gt;\r\n      &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;20&quot;\/&gt;\r\n    &lt;\/g&gt;\r\n  &lt;\/defs&gt;\r\n\r\n  &lt;use href=&quot;#myCircle&quot; x=&quot;0&quot; y=&quot;0&quot; \/&gt;\r\n  &lt;use href=&quot;#myCircle&quot; x=&quot;100&quot; y=&quot;0&quot; fill=&quot;blue&quot; \/&gt;\r\n  &lt;use href=&quot;#myCircle&quot; x=&quot;200&quot; y=&quot;0&quot; fill=&quot;white&quot; stroke=&quot;blue&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t2.13&nbsp;<code>&lt;pattern&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;pattern&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u81ea\u5b9a\u4e49\u4e00\u4e2a\u5f62\u72b6\uff0c\u8be5\u5f62\u72b6\u53ef\u4ee5\u88ab\u5f15\u7528\u6765\u5e73\u94fa\u4e00\u4e2a\u533a\u57df\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;500&quot; height=&quot;500&quot;&gt;\r\n  &lt;defs&gt;\r\n    &lt;pattern id=&quot;dots&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;100&quot; height=&quot;100&quot; patternUnits=&quot;userSpaceOnUse&quot;&gt;\r\n      &lt;circle fill=&quot;#bee9e8&quot; cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;35&quot; \/&gt;\r\n    &lt;\/pattern&gt;\r\n  &lt;\/defs&gt;\r\n  &lt;rect x=&quot;0&quot; y=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot; fill=&quot;url(#dots)&quot; \/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c<code>&lt;pattern&gt;<\/code>\u6807\u7b7e\u5c06\u4e00\u4e2a\u5706\u5f62\u5b9a\u4e49\u4e3a<code>dots<\/code>\u6a21\u5f0f\u3002<code>patternUnits=&quot;userSpaceOnUse&quot;<\/code>\u8868\u793a<code>&lt;pattern&gt;<\/code>\u7684\u5bbd\u5ea6\u548c\u957f\u5ea6\u662f\u5b9e\u9645\u7684\u50cf\u7d20\u503c\u3002\u7136\u540e\uff0c\u6307\u5b9a\u8fd9\u4e2a\u6a21\u5f0f\u53bb\u586b\u5145\u4e0b\u9762\u7684\u77e9\u5f62\u3002\n<\/p>\n<h3>\n\t2.14&nbsp;<code>&lt;image&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;image&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u63d2\u5165\u56fe\u7247\u6587\u4ef6\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg viewBox=&quot;0 0 100 100&quot; width=&quot;100&quot; height=&quot;100&quot;&gt;\r\n  &lt;image xlink:href=&quot;path\/to\/image.jpg&quot;\r\n    width=&quot;50%&quot; height=&quot;50%&quot;\/&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c<code>&lt;image&gt;<\/code>\u7684<code>xlink:href<\/code>\u5c5e\u6027\u8868\u793a\u56fe\u50cf\u7684\u6765\u6e90\u3002\n<\/p>\n<h3>\n\t2.15&nbsp;<code>&lt;animate&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;animate&gt;<\/code>\u6807\u7b7e\u7528\u4e8e\u4ea7\u751f\u52a8\u753b\u6548\u679c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;500px&quot; height=&quot;500px&quot;&gt;\r\n  &lt;rect x=&quot;0&quot; y=&quot;0&quot; width=&quot;100&quot; height=&quot;100&quot; fill=&quot;#feac5e&quot;&gt;\r\n    &lt;animate attributeName=&quot;x&quot; from=&quot;0&quot; to=&quot;500&quot; dur=&quot;2s&quot; repeatCount=&quot;indefinite&quot; \/&gt;\r\n  &lt;\/rect&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u77e9\u5f62\u4f1a\u4e0d\u65ad\u79fb\u52a8\uff0c\u4ea7\u751f\u52a8\u753b\u6548\u679c\u3002\n<\/p>\n<p>\n\t<code>&lt;animate&gt;<\/code>\u7684\u5c5e\u6027\u542b\u4e49\u5982\u4e0b\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\tattributeName\uff1a\u53d1\u751f\u52a8\u753b\u6548\u679c\u7684\u5c5e\u6027\u540d\u3002\n\t\t<\/li>\n<li>\n\t\t\tfrom\uff1a\u5355\u6b21\u52a8\u753b\u7684\u521d\u59cb\u503c\u3002\n\t\t<\/li>\n<li>\n\t\t\tto\uff1a\u5355\u6b21\u52a8\u753b\u7684\u7ed3\u675f\u503c\u3002\n\t\t<\/li>\n<li>\n\t\t\tdur\uff1a\u5355\u6b21\u52a8\u753b\u7684\u6301\u7eed\u65f6\u95f4\u3002\n\t\t<\/li>\n<li>\n\t\t\trepeatCount\uff1a\u52a8\u753b\u7684\u5faa\u73af\u6a21\u5f0f\u3002\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<p>\n\t\u53ef\u4ee5\u5728\u591a\u4e2a\u5c5e\u6027\u4e0a\u9762\u5b9a\u4e49\u52a8\u753b\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;animate attributeName=&quot;x&quot; from=&quot;0&quot; to=&quot;500&quot; dur=&quot;2s&quot; repeatCount=&quot;indefinite&quot; \/&gt;\r\n&lt;animate attributeName=&quot;width&quot; to=&quot;500&quot; dur=&quot;2s&quot; repeatCount=&quot;indefinite&quot; \/&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t2.16&nbsp;<code>&lt;animateTransform&gt;<\/code>\u6807\u7b7e<br \/>\n<\/h3>\n<p>\n\t<code>&lt;animate&gt;<\/code>\u6807\u7b7e\u5bf9 CSS \u7684<code>transform<\/code>\u5c5e\u6027\u4e0d\u8d77\u4f5c\u7528\uff0c\u5982\u679c\u9700\u8981\u53d8\u5f62\uff0c\u5c31\u8981\u4f7f\u7528<code>&lt;animateTransform&gt;<\/code>\u6807\u7b7e\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;500px&quot; height=&quot;500px&quot;&gt;\r\n  &lt;rect x=&quot;250&quot; y=&quot;250&quot; width=&quot;50&quot; height=&quot;50&quot; fill=&quot;#4bc0c8&quot;&gt;\r\n    &lt;animateTransform attributeName=&quot;transform&quot; type=&quot;rotate&quot; begin=&quot;0s&quot; dur=&quot;10s&quot; from=&quot;0 200 200&quot; to=&quot;360 400 400&quot; repeatCount=&quot;indefinite&quot; \/&gt;\r\n  &lt;\/rect&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c<code>&lt;animateTransform&gt;<\/code>\u7684\u6548\u679c\u4e3a\u65cb\u8f6c\uff08<code>rotate<\/code>\uff09\uff0c\u8fd9\u65f6<code>from<\/code>\u548c<code>to<\/code>\u5c5e\u6027\u503c\u6709\u4e09\u4e2a\u6570\u5b57\uff0c\u7b2c\u4e00\u4e2a\u6570\u5b57\u662f\u89d2\u5ea6\u503c\uff0c\u7b2c\u4e8c\u4e2a\u503c\u548c\u7b2c\u4e09\u4e2a\u503c\u662f\u65cb\u8f6c\u4e2d\u5fc3\u7684\u5750\u6807\u3002<code>from=&quot;0 200 200&quot;<\/code>\u8868\u793a\u5f00\u59cb\u65f6\uff0c\u89d2\u5ea6\u4e3a0\uff0c\u56f4\u7ed5<code>(200, 200)<\/code>\u5f00\u59cb\u65cb\u8f6c\uff1b<code>to=&quot;360 400 400&quot;<\/code>\u8868\u793a\u7ed3\u675f\u65f6\uff0c\u89d2\u5ea6\u4e3a360\uff0c\u56f4\u7ed5<code>(400, 400)<\/code>\u65cb\u8f6c\u3002\n<\/p>\n<h2>\n\t\u4e09\u3001JavaScript \u64cd\u4f5c<br \/>\n<\/h2>\n<h3>\n\t3.1 DOM \u64cd\u4f5c<br \/>\n<\/h3>\n<p>\n\t\u5982\u679c SVG \u4ee3\u7801\u76f4\u63a5\u5199\u5728 HTML \u7f51\u9875\u4e4b\u4e2d\uff0c\u5b83\u5c31\u6210\u4e3a\u7f51\u9875 DOM \u7684\u4e00\u90e8\u5206\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528 DOM \u64cd\u4f5c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg\r\n  id=&quot;mysvg&quot;\r\n  xmlns=&quot;<a href=\"http:\/\/www.w3.org\/2000\/svg\">http:\/\/www.w3.org\/2000\/svg<\/a>&quot;\r\n  viewBox=&quot;0 0 800 600&quot;\r\n  preserveAspectRatio=&quot;xMidYMid meet&quot;\r\n&gt;\r\n  &lt;circle id=&quot;mycircle&quot; cx=&quot;400&quot; cy=&quot;300&quot; r=&quot;50&quot; \/&gt;\r\n&lt;svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u63d2\u5165\u7f51\u9875\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u7528 CSS \u5b9a\u5236\u6837\u5f0f\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\ncircle {\r\n  stroke-width: 5;\r\n  stroke: #f00;\r\n  fill: #ff0;\r\n}\r\n\r\ncircle:hover {\r\n  stroke: #090;\r\n  fill: #fff;\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u7136\u540e\uff0c\u53ef\u4ee5\u7528 JavaScript \u4ee3\u7801\u64cd\u4f5c SVG\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nvar mycircle = document.getElementById(&#039;mycircle&#039;);\r\n\r\nmycircle.addEventListener(&#039;click&#039;, function(e) {\r\n  console.log(&#039;circle clicked - enlarging&#039;);\r\n  mycircle.setAttribute(&#039;r&#039;, 60);\r\n}, false);\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u6307\u5b9a\uff0c\u5982\u679c\u70b9\u51fb\u56fe\u5f62\uff0c\u5c31\u6539\u5199<code>circle<\/code>\u5143\u7d20\u7684<code>r<\/code>\u5c5e\u6027\u3002\n<\/p>\n<h3>\n\t3.2 \u83b7\u53d6 SVG DOM<br \/>\n<\/h3>\n<p>\n\t\u4f7f\u7528<code>&lt;object&gt;<\/code>\u3001<code>&lt;iframe&gt;<\/code>\u3001<code>&lt;embed&gt;<\/code>\u6807\u7b7e\u63d2\u5165 SVG \u6587\u4ef6\uff0c\u53ef\u4ee5\u83b7\u53d6 SVG DOM\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nvar svgObject = document.getElementById(&#039;object&#039;).contentDocument;\r\nvar svgIframe = document.getElementById(&#039;iframe&#039;).contentDocument;\r\nvar svgEmbed = document.getElementById(&#039;embed&#039;).getSVGDocument();\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u6ce8\u610f\uff0c\u5982\u679c\u4f7f\u7528<code>&lt;img&gt;<\/code>\u6807\u7b7e\u63d2\u5165 SVG \u6587\u4ef6\uff0c\u5c31\u65e0\u6cd5\u83b7\u53d6 SVG DOM\u3002\n<\/p>\n<h3>\n\t3.3 \u8bfb\u53d6 SVG \u6e90\u7801<br \/>\n<\/h3>\n<p>\n\t\u7531\u4e8e SVG \u6587\u4ef6\u5c31\u662f\u4e00\u6bb5 XML \u6587\u672c\uff0c\u56e0\u6b64\u53ef\u4ee5\u901a\u8fc7\u8bfb\u53d6 XML \u4ee3\u7801\u7684\u65b9\u5f0f\uff0c\u8bfb\u53d6 SVG \u6e90\u7801\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;div id=&quot;svg-container&quot;&gt;\r\n  &lt;svg\r\n    xmlns=&quot;<a href=\"http:\/\/www.w3.org\/2000\/svg\">http:\/\/www.w3.org\/2000\/svg<\/a>&quot;\r\n    xmlns:xlink=&quot;<a href=\"http:\/\/www.w3.org\/1999\/xlink\">http:\/\/www.w3.org\/1999\/xlink<\/a>&quot;\r\n    xml:space=&quot;preserve&quot; width=&quot;500&quot; height=&quot;440&quot;\r\n  &gt;\r\n    &lt;!-- svg code --&gt;\r\n  &lt;\/svg&gt;\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4f7f\u7528<code>XMLSerializer<\/code>\u5b9e\u4f8b\u7684<code>serializeToString()<\/code>\u65b9\u6cd5\uff0c\u83b7\u53d6 SVG \u5143\u7d20\u7684\u4ee3\u7801\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nvar svgString = new XMLSerializer()\r\n  .serializeToString(document.querySelector(&#039;svg&#039;));\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t3.4 SVG \u56fe\u50cf\u8f6c\u4e3a Canvas \u56fe\u50cf<br \/>\n<\/h3>\n<p>\n\t\u9996\u5148\uff0c\u9700\u8981\u65b0\u5efa\u4e00\u4e2a<code>Image<\/code>\u5bf9\u8c61\uff0c\u5c06 SVG \u56fe\u50cf\u6307\u5b9a\u5230\u8be5<code>Image<\/code>\u5bf9\u8c61\u7684<code>src<\/code>\u5c5e\u6027\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nvar img = new Image();\r\nvar svg = new Blob([svgString], {type: &quot;image\/svg+xml;charset=utf-8&quot;});\r\n\r\nvar DOMURL = self.URL || self.webkitURL || self;\r\nvar url = DOMURL.createObjectURL(svg);\r\n\r\nimg.src = url;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u7136\u540e\uff0c\u5f53\u56fe\u50cf\u52a0\u8f7d\u5b8c\u6210\u540e\uff0c\u518d\u5c06\u5b83\u7ed8\u5236\u5230<code>&lt;canvas&gt;<\/code>\u5143\u7d20\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nimg.onload = function () {\r\n  var canvas = document.getElementById(&#039;canvas&#039;);\r\n  var ctx = canvas.getContext(&#039;2d&#039;);\r\n  ctx.drawImage(img, 0, 0);\r\n};\r\n<\/code><\/pre>\n<\/blockquote>\n<h2>\n\t\u56db\u3001\u5b9e\u4f8b\uff1a\u6298\u7ebf\u56fe<br \/>\n<\/h2>\n<p>\n\t\u4e0b\u9762\u5c06\u4e00\u5f20\u6570\u636e\u8868\u683c\u753b\u6210\u6298\u7ebf\u56fe\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nDate |Amount\r\n-----|------\r\n2014-01-01 | $10\r\n2014-02-01 | $20\r\n2014-03-01 | $40\r\n2014-04-01 | $80\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u7684\u56fe\u5f62\uff0c\u53ef\u4ee5\u753b\u6210\u4e00\u4e2a\u5750\u6807\u7cfb\uff0c<code>Date<\/code>\u4f5c\u4e3a\u6a2a\u8f74\uff0c<code>Amount<\/code>\u4f5c\u4e3a\u7eb5\u8f74\uff0c\u56db\u884c\u6570\u636e\u753b\u6210\u4e00\u4e2a\u6570\u636e\u70b9\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;svg width=&quot;350&quot; height=&quot;160&quot;&gt;\r\n  &lt;g class=&quot;layer&quot; transform=&quot;translate(60,10)&quot;&gt;\r\n    &lt;circle r=&quot;5&quot; cx=&quot;0&quot;   cy=&quot;105&quot; \/&gt;\r\n    &lt;circle r=&quot;5&quot; cx=&quot;90&quot;  cy=&quot;90&quot;  \/&gt;\r\n    &lt;circle r=&quot;5&quot; cx=&quot;180&quot; cy=&quot;60&quot;  \/&gt;\r\n    &lt;circle r=&quot;5&quot; cx=&quot;270&quot; cy=&quot;0&quot;   \/&gt;\r\n\r\n    &lt;g class=&quot;y axis&quot;&gt;\r\n      &lt;line x1=&quot;0&quot; y1=&quot;0&quot; x2=&quot;0&quot; y2=&quot;120&quot; \/&gt;\r\n      &lt;text x=&quot;-40&quot; y=&quot;105&quot; dy=&quot;5&quot;&gt;$10&lt;\/text&gt;\r\n      &lt;text x=&quot;-40&quot; y=&quot;0&quot;   dy=&quot;5&quot;&gt;$80&lt;\/text&gt;\r\n    &lt;\/g&gt;\r\n    &lt;g class=&quot;x axis&quot; transform=&quot;translate(0, 120)&quot;&gt;\r\n      &lt;line x1=&quot;0&quot; y1=&quot;0&quot; x2=&quot;270&quot; y2=&quot;0&quot; \/&gt;\r\n      &lt;text x=&quot;-30&quot;   y=&quot;20&quot;&gt;January 2014&lt;\/text&gt;\r\n      &lt;text x=&quot;240&quot; y=&quot;20&quot;&gt;April&lt;\/text&gt;\r\n    &lt;\/g&gt;\r\n  &lt;\/g&gt;\r\n&lt;\/svg&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<h2>\n\t\u4e94\u3001\u53c2\u8003\u94fe\u63a5<br \/>\n<\/h2>\n<ul>\n<li>\n\t\tJon McPartland,&nbsp;<a href=\"http:\/\/bigbitecreative.com\/introduction-svg-animation\/\" target=\"_blank\">An introduction to SVG animation<\/a>\n\t<\/li>\n<li>\n\t\tAlexander Goedde,&nbsp;<a href=\"http:\/\/tavendo.com\/blog\/post\/super-vector-graphics\/\" target=\"_blank\">SVG &#8211; Super Vector Graphics<\/a>\n\t<\/li>\n<li>\n\t\tJoseph Wegner,&nbsp;<a href=\"http:\/\/flippinawesome.org\/2014\/02\/03\/learning-svg\/\" target=\"_blank\">Learning SVG<\/a>\n\t<\/li>\n<li>\n\t\tbiovisualize,&nbsp;<a href=\"http:\/\/bl.ocks.org\/biovisualize\/8187844\" target=\"_blank\">Direct svg to canvas to png conversion<\/a>\n\t<\/li>\n<li>\n\t\tTyler Sticka,&nbsp;<a href=\"https:\/\/cloudfour.com\/thinks\/cropping-image-thumbnails-with-svg\/\" target=\"_blank\">Cropping Image Thumbnails with SVG<\/a>\n\t<\/li>\n<li>\n\t\tAdi Purdila,&nbsp;<a href=\"https:\/\/webdesign.tutsplus.com\/tutorials\/how-to-create-a-loader-icon-with-svg-animations--cms-31542\" target=\"_blank\">How to Create a Loader Icon With SVG Animations<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"http:\/\/www.ruanyifeng.com\/blog\/2018\/08\/svg.html\" name=\"SVG \u56fe\u50cf\u5165\u95e8\u6559\u7a0b\" target=\"_blank\" title=\"SVG \u56fe\u50cf\u5165\u95e8\u6559\u7a0b\">SVG \u56fe\u50cf\u5165\u95e8\u6559\u7a0b<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2964\">SVG \u56fe\u50cf\u5165\u95e8\u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u6982\u8ff0 SVG \u662f\u4e00\u79cd\u57fa\u4e8e XML \u8bed\u6cd5\u7684\u56fe\u50cf\u683c\u5f0f\uff0c\u5168\u79f0\u662f\u53ef\u7f29\u653e\u77e2\u91cf\u56fe\uff08Scalable Vector Gr [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[52,1565,1563,1186,1552],"class_list":["post-2964","post","type-post","status-publish","format-standard","hentry","category-html5","tag-svg","tag-svg-to-react","tag-svgr","tag-vlc-web","tag-webgl"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2964"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2964\/revisions"}],"predecessor-version":[{"id":2965,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2964\/revisions\/2965"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}