{"id":4333,"date":"2014-08-31T03:07:09","date_gmt":"2014-08-30T19:07:09","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=4333"},"modified":"2020-08-08T14:03:13","modified_gmt":"2020-08-08T06:03:13","slug":"so-powerful-svg-smil-animation","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2014\/08\/so-powerful-svg-smil-animation\/","title":{"rendered":"\u8d85\u7ea7\u5f3a\u5927\u7684SVG SMIL animation\u52a8\u753b\u8be6\u89e3"},"content":{"rendered":"<p><span class=\"s\">\/\/zxx: \u672c\u6587\u7684SVG\u5728\u6709\u7f13\u5b58\u65f6\u5019\u662f\u65e0\u52a8\u753b\u6548\u679c\uff0c\u6b64\u65f6\u60a8\u53ef\u4ee5\u8bd5\u7740\u3010\u53f3\u952e-\u65b0\u6807\u7b7e\u9875\u6253\u5f00\u56fe\u7247\u3011\u3002<\/span><\/p>\n<h3>\u4e00\u3001SVG SMIL animation\u6982\u89c8<\/h3>\n<p><strong>1. SMIL\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\nSMIL\u4e0d\u662f\u6307\u300c\u6c34\u871c\u68a8\u300d\uff0c\u800c\u662f<a href=\"http:\/\/www.w3.org\/TR\/REC-smil\">Synchronized Multimedia Integration Language<\/a>\uff08\u540c\u6b65\u591a\u5a92\u4f53\u96c6\u6210\u8bed\u8a00\uff09\u7684\u9996\u5b57\u6bcd\u7f29\u5199\u7b80\u79f0\uff0c\u662f\u6709\u6807\u51c6\u7684\u3002\u672c\u6587\u6240\u8981\u4ecb\u7ecd\u7684SVG\u52a8\u753b\u5c31\u662f\u57fa\u4e8e\u8fd9\u79cd\u8bed\u8a00\u3002<\/p>\n<p>SMIL\u5141\u8bb8\u4f60\u505a\u4e0b\u9762\u8fd9\u4e9b\u4e8b\u60c5\uff1a<\/p>\n<ul>\n<li>\u52a8\u753b\u5143\u7d20\u7684\u6570\u503c\u5c5e\u6027\uff08X, Y, &#8230;\uff09 <\/li>\n<li>\u52a8\u753b\u5c5e\u6027\u53d8\u6362\uff08\u5e73\u79fb\u6216\u65cb\u8f6c\uff09<\/li>\n<li>\u52a8\u753b\u989c\u8272\u5c5e\u6027<\/li>\n<li>\u6cbf\u7740\u8fd0\u52a8\u8def\u5f84\u8fd0\u52a8<\/li>\n<\/ul>\n<p>\u6ce8\u610f\u5230\u201c\u6cbf\u7740\u8fd0\u52a8\u8def\u5f84\u8fd0\u52a8\u201d\u8fd9\u4e00\u6761\u6ca1\uff1f\u524d\u9762\u7684\u4e09\u6761CSS3\u90fd\u662f\u53ef\u4ee5\u6709\u6240\u62c5\u5f53\u7684\uff0c\u6700\u540e\u8fd9\u4e00\u6761\uff0c\u5475\u5475\uff0cCSS3\u53ea\u80fd\u8e72\u5728\u5899\u89d2\u753b\u5708\u5708\u4e86\uff01\uff08\u66f4\u6b63\u4e0e2020-08-08  \u76ee\u524dCSS <code>offset<\/code>\u5c5e\u6027\u4e5f\u53ef\u4ee5\u8ba9\u5143\u7d20\u6cbf\u7740\u989d\u4e0d\u89c4\u5219\u8def\u5f84\u8fd0\u52a8\uff09<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201408\/qjhqq.png\" width=\"277\" height=\"201\" alt=\"\u5899\u89d2\u753b\u5708\u5708\" class=\"mt10\" \/><\/p>\n<blockquote><p>SVG\u7684\u52a8\u753b\u5143\u7d20\u662f\u548cSMIL\u5f00\u53d1\u7ec4\u5408\u4f5c\u5f00\u53d1\u7684\u3002SMIL\u5f00\u53d1\u7ec4\u548cSVG\u5f00\u53d1\u7ec4\u5408\u4f5c\u5f00\u53d1\u4e86SMIL\u52a8\u753b\u89c4\u8303\uff0c\u5728\u89c4\u8303\u4e2d\u5236\u5b9a\u4e86\u4e00\u4e2a\u57fa\u672c\u7684XML\u52a8\u753b\u7279\u5f81\u96c6\u5408\u3002SVG\u5438\u6536\u4e86SMIL\u52a8\u753b\u89c4\u8303\u5f53\u4e2d\u7684\u52a8\u753b\u4f18\u70b9\uff0c\u5e76\u63d0\u4f9b\u4e86\u4e00\u4e9bSVG\u7ee7\u627f\u5b9e\u73b0\u3002<\/p><\/blockquote>\n<p><strong>2. \u5f3a\u5927\u4e4b\u5904\u662f\uff1f<\/strong><br \/>\n\u9664\u4e86\u53ef\u4ee5\u5b9e\u73b0\u300c\u8def\u5f84\u52a8\u753b\u300d\uff0cSVG animation\u6700\u5f3a\u5927\u7684\u5730\u65b9\u5728\u4e8e\uff1a\u2122\u53ea\u8981\u5728\u9875\u9762\u653e\u51e0\u4e2a<code>animate<\/code>\u5143\u7d20\uff0c\u6ca1\u6709\u4efb\u4f55CSS, \u6ca1\u6709\u4efb\u4f55JS\uff0c\u9875\u9762\u4e0a\u7684\u5143\u7d20\u5c31\u50cf\u662f\u6ca1\u5403\u8349\u7684\u9a6c\u513f\u4e00\u6837\uff0c\u6109\u5feb\u5730\u8dd1\u8d77\u6765\u4e86\u3002\u4f60\u4f1a\u53d1\u73b0\uff0c\u6211\u52d2\u4e2a\u53bb\uff0c\u539f\u6765\u8981\u5b9e\u73b0\u4e2a\u52a8\u753b\u6548\u679c\u8fd9\u4e48\u7b80\u5355\u3002\u4ec0\u4e48CSS3\u52a8\u753b\uff0c\u54ea\u8fb9\u51c9\u5feb\u54ea\u8fb9\u5446\u7740\u5427\uff01<\/p>\n<p>\u5537\uff0c\u4e0d\u4fe1\uff1f\u7ed9\u4f60\u4e2a\u9a6c\uff0c\u770b\u5b83\u8dd1\u4e0d\u8dd1\uff01<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"320\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n  &lt;g> \r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c&lt;\/text>\r\n    &lt;animateTransform attributeName=\"transform\" begin=\"0s\" dur=\"10s\" type=\"rotate\" from=\"0 160 160\" to=\"360 160 160\" repeatCount=\"indefinite\"\/>\r\n  &lt;\/g>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse.svg\" width=\"320\" height=\"320\" alt=\"\u65cb\u8f6c\u6728\u9a6c\"><\/p>\n<p>\u5982\u4f55\uff1f\u662f\u4e0d\u662f\u770b\u5230\u4e86\u7ae5\u5e74\u68a6\u5e7b\u7684\u65cb\u8f6c\u6728\u9a6c\u6548\u679c\uff1f<img decoding=\"async\" src=\"http:\/\/mat1.gtimg.com\/www\/mb\/images\/face\/101.gif\" align=\"absmiddle\"> \u7eb3\u5c3c\uff1f\u4f60\u6ca1\u770b\u5230\u3002\u8bf7\u68c0\u67e5\u60a8\u73b0\u5728\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\uff0cIE\u6d4f\u89c8\u5668(\u5305\u62ecIE11)\u662f\u4e0d\u652f\u6301\u7684\u54e6\uff0c\u4eb2~<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201408\/2014-08-28_163516.png\" width=\"549\" height=\"326\" alt=\"SVG SMIL animation\u7684\u6d4f\u89c8\u5668\u652f\u6301\u8868\" class=\"alignnone\" \/><\/p>\n<p>\u5982\u679c\u4e0d\u662f\u6d4f\u89c8\u5668\u539f\u56e0\uff0c\u90a3\u5c31\u662f\u7f13\u5b58\u4f5c\u795f\uff0c\u53ef\u4ee5\u70b9\u51fb\u8fd9\u91cc\u6d4f\u89c8\u5668\u8bbf\u95ee\uff1a<a class=\"a_link\" href=\"\/study\/201408\/horse.svg\" target=\"_blank\">horse.svg<\/a>\u3002<\/p>\n<h3>\u4e8c\u3001SVG animation\u5143\u7d20\u53ca\u6548\u679c\u6982\u89c8<\/h3>\n<p>5\u5927\u5143\u7d20\uff0c1\u7edf\u6c5f\u6e56\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201408\/5-1.jpg\" width=\"360\" height=\"166\" alt=\"5\u5927\u53d7\u635f \u4e00\u4e2a\u5bf9\u7b56\" class=\"alignnone\" \/><\/p>\n<ol>\n<li>&lt;set&gt;<\/li>\n<li>&lt;animate&gt;<\/li>\n<li>&lt;animateColor&gt;<\/li>\n<li>&lt;animateTransform&gt;<\/li>\n<li>&lt;animateMotion&gt;<\/li>\n<\/ol>\n<p>\u8fd95\u4e2a\u5143\u7d20\u72b9\u5982\u7bee\u7403\u573a\u4e0a\u76845\u540d\u961f\u5458\uff0c\u5206\u522b\u5b9e\u73b0\u4e0d\u540c\u7c7b\u522b\u7684\u52a8\u753b\u3002<\/p>\n<p><strong>1. set<\/strong><br \/>\n<code>set<\/code>\u610f\u601d\u8bbe\u7f6e\uff0c\u6b64\u5143\u7d20\u6ca1\u6709\u52a8\u753b\u6548\u679c\u3002\u4f60\u53ef\u80fd\u4f1a\u7591\u95ee\u4e86\uff0c\u65e2\u7136\u8fd9\u4e2a\u5143\u7d20\u6ca1\u6709\u52a8\u753b\u6548\u679c\uff0c\u600e\u4e48\u4f1a\u662fanimation\u4e94\u5927\u5929\u56e2\u6210\u5458\u4e4b\u4e00\u5462\uff1f<\/p>\n<p>OK, \u8fd9\u6837\u7684\uff0c\u867d\u7136<code>set<\/code>\u867d\u7136\u4e0d\u80fd\u89e6\u53d1\u8fde\u7eed\u7684\u52a8\u753b\uff0c\u4f46\u662f\uff0c\u5176\u8fd8\u662f\u53ef\u4ee5\u5b9e\u73b0\u57fa\u672c\u7684\u5ef6\u8fdf\u529f\u80fd\u3002\u5c31\u662f\u6307\uff1a\u53ef\u4ee5\u5728\u7279\u5b9a\u65f6\u95f4\u4e4b\u540e\u4fee\u6539\u67d0\u4e2a\u5c5e\u6027\u503c\uff08\u4e5f\u53ef\u4ee5\u662fCSS\u5c5e\u6027\u503c\uff09\u3002<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4e0b\u9762\u8fd9\u4e2a\u300c\u9a6c\u300d\u4f1a\u5728<code>3<\/code>\u79d2\u4e4b\u540e\u4ece\u6a2a\u5750\u6807<code>160<\/code>\u7684\u4f4d\u7f6e\u79fb\u52a8<code>60<\/code>\u8fd9\u4e2a\u4f4d\u7f6e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-set.svg\" width=\"320\" height=\"320\" alt=\"3\u79d2\u540e\u4f1a\u79fb\u52a8\u7684\u9a6c\"><\/p>\n<p>\u5982\u679c\u60a8\u786e\u4fe1\u60a8\u7684\u6d4f\u89c8\u5668\u591f\u575a\u633a\uff0c\u540c\u65f6\u6ca1\u770b\u5230\u9a6c\u513f\u7a81\u7136\u7684\u4f4d\u79fb\u6548\u679c\uff08\u7f13\u5b58\uff09\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/201408\/horse-set.svg\" target=\"_blank\">horse-set.svg<\/a><\/p>\n<p>\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00SVG\u4e00\u7779\u771f\u5bb9\u5427~~<\/p>\n<p>\u76f8\u5173\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"320\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n  &lt;g> \r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\r\n      \u9a6c\r\n      &lt;<span style=\"color:#cd0000;\">set<\/span> attributeName=\"x\" attributeType=\"XML\" to=\"60\" begin=\"3s\" \/>\r\n    &lt;\/text>\r\n  &lt;\/g>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u8fd9\u91cc\u51fa\u73b0\u4e86<code>attributeName<\/code>, <code>attributeType<\/code>\u7b49\u5c5e\u6027\u3002\u5176\u542b\u4e49\u6709\u4e9b\u987e\u540d\u5373\u53ef\u601d\u610f\uff0c\u6709\u4e9b\u9700\u8981\u70b9\u62e8\uff0c\u8fd9\u4e9b\u5c5e\u6027\u540e\u9762\u4f1a\u7edf\u4e00\u8bb2\u89e3\u3002<\/p>\n<p><strong>2. animate<\/strong><br \/>\n\u57fa\u7840\u52a8\u753b\u5143\u7d20\u3002\u5b9e\u73b0\u5355\u5c5e\u6027\u7684\u52a8\u753b\u8fc7\u6e21\u6548\u679c\u3002\u7c7b\u4f3cSnap.svg\u7684<code>animate()<\/code>\u65b9\u6cd5\u652f\u6301\u7684\u52a8\u753b\u6548\u679c\u3002<\/p>\n<p>\u4e0b\u9762\u8fd9\u4e2a\u9a6c\u513f\u5954\u8dd1\u7684\u6548\u679c\u5c31\u662f\u4f7f\u7528\u7684<code>animate<\/code>\u5143\u7d20\uff08\u6ca1\u6709\u52a8\u753b\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-animate.svg\" target=\"_blank\">horse-animate.svg<\/a>\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-animate.svg\" width=\"320\" height=\"200\" alt=\"\u4e0d\u505c\u5954\u8dd1\u7684\u9a6c\"><\/p>\n<p>\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"320\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n  &lt;g> \r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\r\n    \u9a6c\r\n      &lt;<span style=\"color:#cd0000;\">animate<\/span> attributeName=\"x\" from=\"160\" to=\"60\" begin=\"0s\" dur=\"3s\" repeatCount=\"indefinite\" \/>\r\n    &lt;\/text>\r\n  &lt;\/g>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u8fd9\u91cc\u9664\u4e86\u65b0\u589e<code>from<\/code>, <code>dur<\/code>\u8fd9\u4e24\u4e2a\u901a\u4fd7\u6613\u61c2\u7684\u5c5e\u6027\u5916\uff0c\u8fd8\u8e66\u51fa\u4e86\u4e2arepeatCount\u5c5e\u6027\uff0c\u540c\u4e0a\uff0c\u542b\u4e49\u4f1a\u540e\u9762\u7edf\u4e00\u8bb2\u89e3\u3002<\/p>\n<p><strong>3. animateColor<\/strong><br \/>\n\u4e00\u770b\u5c31\u77e5\u9053\u662f\u989c\u8272\u52a8\u753b\u3002\u4e0d\u8fc7\uff0canimate\u53ef\u4ee5\u5b9e\u73b0\u5176\u529f\u80fd\u4e0e\u6548\u679c\uff0c\u56e0\u6b64\uff0c\u6b64\u5c5e\u6027\u5df2\u7ecf\u88ab\u5e9f\u5f03\u3002\u53ef\u8c13\u56e0\u4e3a\u5144\u5f1f\u76f8\u4e89\u800c\u5e74\u5c11\u9668\u843d\u7684\u5929\u738b\u3002\u901d\u8005\u5df2\u77e3\uff0c\u8fc7\u53bb\u7684\u5c31\u8ba9\u5b83\u8fc7\u53bb\u5427~~<\/p>\n<p><strong>4. animateTransform<\/strong><br \/>\n\u6b64\u5143\u7d20\u5c31\u662f\u4e00\u5f00\u59cb\u7ed9\u5927\u5bb6\u5f00\u773c\u754c\u7528\u5230\u7684\u90a3\u4e2a\u5143\u7d20\u3002\u4e00\u770b\u5c31\u77e5\u9053\u5b9e\u73b0<code>transform<\/code>\u53d8\u6362\u52a8\u753b\u6548\u679c\u7684\u3002\u77e5\u8bc6\u662f\u4e00\u8109\u76f8\u627f\u7684\uff0c\u8fd9\u91cc\u7684<code>transform<\/code>\u53d8\u6362\u4e0eCSS3\u7684<code>transform<\/code>\u53d8\u6362\uff0c\u4ee5\u53caSnap.svg.js\u4e2d\u7684<code>transform()<\/code>\u65b9\u6cd5\u90fd\u662f\u4e00\u4e2a\u8def\u6570\u3002<\/p>\n<p>\u4e3a\u907f\u514d\u6548\u679c\u91cd\u590d\uff0c\u73b0\u5728\u9644\u4e0a\u4e00\u4e2a\u5feb\u901f\u957f\u5927\u7684\u9a6c\u7684\u6548\u679c\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-scale.svg\" target=\"_blank\">horse-scale.svg<\/a>\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-scale.svg\" width=\"320\" height=\"200\" alt=\"\u5feb\u901f\u957f\u5927\u7684\u9a6c\"><\/p>\n<p>SVG\u4ee3\u7801\u4e3a\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"320\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n  &lt;g> \r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"80\" y=\"100\" x=\"100\">\u9a6c&lt;\/text>\r\n    &lt;<span style=\"color:#cd0000;\">animateTransform<\/span> attributeName=\"transform\" begin=\"0s\" dur=\"3s\"  type=\"scale\" from=\"1\" to=\"1.5\" repeatCount=\"indefinite\"\/>\r\n  &lt;\/g>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p><strong>5. animateMotion<\/strong><br \/>\n<code>animateMotion<\/code>\u5143\u7d20\u53ef\u4ee5\u8ba9SVG\u5404\u79cd\u56fe\u5f62\u6cbf\u7740\u7279\u5b9a\u7684<code>path<\/code>\u8def\u5f84\u8fd0\u52a8~<\/p>\n<p>\u5148\u6765\u611f\u53d7\u4e00\u5339\u8d70\u5c71\u8def\u7684\u9a6c\u7684\u82f1\u59ff\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-motion.svg\" target=\"_blank\">horse-motion.svg<\/a>\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-motion.svg\" width=\"360\" height=\"200\" alt=\"\u8d70\u5c71\u8def\u7684\u9a6c\"><\/p>\n<p>SVG code as follow:<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"360\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n  &lt;text font-family=\"microsoft yahei\" font-size=\"40\" x=\"0\" y=\"0\" fill=\"#cd0000\">\u9a6c\r\n    &lt;<span style=\"color:#cd0000;\">animateMotion<\/span> path=\"M10,80 q100,120 120,20 q140,-50 160,0\" begin=\"0s\" dur=\"3s\" repeatCount=\"indefinite\"\/>\r\n  &lt;\/text>\r\n  &lt;path d=\"M10,80 q100,120 120,20 q140,-50 160,0\" stroke=\"#cd0000\" stroke-width=\"2\" fill=\"none\" \/>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u8ddf\u4e0a\u9762\u7684SVG\u4ee3\u7801\u76f8\u6bd4\uff0c\u5c11\u4e2a\u7ec4\u6807\u7b7e<code>g<\/code>\u5143\u7d20\u3002\u65e0\u59a8\u3002\u53ea\u8981\u52a8\u753b\u5143\u7d20\u662f\u56fe\u5f62\u5143\u7d20\u5b50\u5143\u7d20\u5c31\u53ef\u4ee5\u3002\u540e\u9762\u7684<code>path<\/code>\u5143\u7d20\u4e0e\u52a8\u753b\u6548\u679c\u65e0\u5173\uff0c\u53ea\u662f\u4e3a\u4e86\u8ba9\u5927\u5bb6\u770b\u6e05\u695a\u8def\u5f84\u8f68\u8ff9\u7ebf\u6761\u3002\u5173\u4e8e<code>path<\/code>\u7684\u4e00\u7cfb\u5217\u53c2\u6570\u503c\uff0c\u53ef\u4ee5\u53c2\u8003\u6211\u4e4b\u524d\u7684\u6587\u7ae0\uff1a\u201c<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/2014\/06\/deep-understand-svg-path-bezier-curves-command\/\">\u6df1\u5ea6\u638c\u63e1SVG\u8def\u5f84path\u7684\u8d1d\u585e\u5c14\u66f2\u7ebf\u6307\u4ee4<\/a>\u201d\u3002<\/p>\n<p>\u4e0d\u8fc7\u4e0a\u9762\u8fd9\u4e2a\u9a6c\u8d70\u5f97\u6709\u70b9\u5047\uff0c\u600e\u4e48\u9a6c\u513f\u4e00\u76f4\u90fd\u662f\u6c34\u5e73\u7684\u554a\uff0c\u8fd9\u4e0d\u7b26\u5408\u7269\u7406\u5b66\u5b9a\u5f8b\uff0c\u662f\u4e0d\u79d1\u5b66\u7684\u3002\u6211\u4eec\u53ef\u4ee5\u5c0f\u5c0f\u5904\u7406\u4e0b\uff0c\u8ba9\u8868\u73b0\u66f4\u771f\u5b9e\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"360\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n  &lt;text font-family=\"microsoft yahei\" font-size=\"40\" x=\"0\" y=\"0\" fill=\"#cd0000\">\u9a6c\r\n    &lt;animateMotion path=\"M10,80 q100,120 120,20 q140,-50 160,0\" begin=\"0s\" dur=\"3s\" <span style=\"color:#cd0000;\">rotate=\"auto\"<\/span> repeatCount=\"indefinite\"\/>\r\n  &lt;\/text>\r\n  &lt;path d=\"M10,80 q100,120 120,20 q140,-50 160,0\" stroke=\"#cd0000\" stroke-width=\"2\" fill=\"none\" \/>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-motion-rotate.svg\" width=\"360\" height=\"200\" alt=\"\u8d70\u5c71\u8def\u7684\u9a6c\"><\/p>\n<p>\u54c8\uff0c\u8fd9\u6837\u624d\u6709\u722c\u5761\u7684\u611f\u89c9\u561b\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-motion-rotate.svg\" target=\"_blank\">horse-motion-rotate.svg<\/a>\uff09\uff01<\/p>\n<p><strong>6. \u81ea\u7531\u7ec4\u5408<\/strong><br \/>\n\u5b9e\u9645\u5236\u4f5c\u65f6\u5019\u7684\u52a8\u753b\uff0c\u4e0d\u53ef\u80fd\u603b\u662f\u4e00\u4e2a\u5c5e\u6027\u4fee\u6539\u3002\u6bd4\u65b9\u8bf4\uff0c\u4f4d\u7f6e\u548c\u900f\u660e\u5ea6\u540c\u65f6\u53d8\u5316\uff0c\u600e\u4e48\u529e\u5462\uff1fSo easy! \u76f4\u63a5\u7ec4\u5408\u5c31\u597d\u4e86\u3002<img decoding=\"async\" src=\"http:\/\/mat1.gtimg.com\/www\/mb\/images\/face\/29.gif\" align=\"absmiddle\"><\/p>\n<p>\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c\r\n        &lt;animate attributeName=\"x\" from=\"160\" to=\"60\" begin=\"0s\" dur=\"3s\" repeatCount=\"indefinite\" \/>\r\n        &lt;animate attributeName=\"opacity\" from=\"1\" to=\"0\" begin=\"0s\" dur=\"3s\" repeatCount=\"indefinite\" \/>\r\n    &lt;\/text>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u5b9e\u73b0\u7684\u662f\u9a6c\u513f\u5165\u5c71\u5f71\u65e0\u8e2a\u7684\u610f\u5883\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-combine.svg\" target=\"_blank\">horse-combine.svg<\/a>\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-combine.svg\" width=\"320\" height=\"200\" alt=\"\u9a6c\u513f\u5165\u5c71\u5f71\u65e0\u8e2a\" class=\"mt10\"><\/p>\n<p>OK, \u81f3\u6b64\uff0c\u4f53\u9a8cSVG animation\u52a8\u753b\u6548\u679c\u7684\u65c5\u7a0b\u5c31\u7ed3\u675f\u4e86\u3002\u5982\u679c\u60a8\u5355\u7eaf\u5c31\u662f\u6765\u611f\u53d7\u611f\u53d7\u5f00\u9614\u4e0b\u773c\u754c\uff0c\u4e0b\u9762\u7684\u6587\u5b57\u5185\u5bb9\u53ef\u4ee5\u5feb\u901f\u63a0\u8fc7\u4e86\u3002\u5982\u679c\u60a8\u662f\u8981\u6df1\u5165\u5b66\u4e60SVG animation\u52a8\u753b\uff0c\u4e0b\u9762\u7684\u53c2\u6570\u8be6\u89e3\u7bc7\u5b9e\u5728\u662f\u4e0d\u5bb9\u9519\u8fc7\u3002<\/p>\n<h3>\u4e09\u3001SVG animation\u53c2\u6570\u8be6\u89e3<\/h3>\n<p><strong>1. attributeName = &lt;attributeName&gt;<\/strong><br \/>\n\u8981\u53d8\u5316\u7684\u5143\u7d20\u5c5e\u6027\u540d\u79f0\uff0c\u2460 \u53ef\u4ee5\u662f\u5143\u7d20\u76f4\u63a5\u66b4\u9732\u7684\u5c5e\u6027\uff0c\u4f8b\u5982\uff0c\u5bf9\u4e8e\u672c\u6587\u53cd\u590d\u51fa\u73b0\u7684\u300c\u9a6c\u300d\u5bf9\u5e94\u7684<code>text<\/code>\u5143\u7d20\u4e0a\u7684<code>x<\/code>, <code>y<\/code>\u6216\u8005<code>font-size<\/code>; \u2461 \u53ef\u4ee5\u662fCSS\u5c5e\u6027\u3002\u4f8b\u5982\uff0c\u900f\u660e\u5ea6<code>opacity<\/code>.<\/p>\n<p><strong>2. attributeType = &#8220;CSS | XML | auto&#8221;<\/strong><br \/>\n<code>attributeType<\/code>\u652f\u6301\u4e09\u4e2a\u56fa\u5b9a\u53c2\u6570\uff0c<code>CSS<\/code>\/<code>XML<\/code>\/<code>auto<\/code>. \u7528\u6765\u8868\u660e<code>attributeName<\/code>\u5c5e\u6027\u503c\u7684\u5217\u8868\u3002<code>x<\/code>, <code>y<\/code>\u4ee5\u53ca<code>transform<\/code>\u5c31\u5c5e\u4e8e<code>XML<\/code>, <code>opacity<\/code>\u5c31\u5c5e\u4e8e<code>CSS<\/code>. <code>auto<\/code>\u4e3a\u9ed8\u8ba4\u503c\uff0c\u81ea\u52a8\u5224\u522b\u7684\u610f\u601d\uff08\u5b9e\u9645\u4e0a\u662f\u5148\u5f53\u6210CSS\u5904\u7406\uff0c\u5982\u679c\u53d1\u73b0\u4e0d\u8ba4\u8bc6\uff0c\u76f4\u63a5XML\u7c7b\u522b\u5904\u7406\uff09\u3002\u56e0\u6b64\uff0c\u5982\u679c\u4f60\u4e0d\u786e\u4fe1\u67d0\u5c5e\u6027\u662fXML\u7c7b\u522b\u8fd8\u662fCSS\u7c7b\u522b\u7684\u65f6\u5019\uff0c\u6211\u7684\u5efa\u8bae\u662f\u4e0d\u8bbe\u7f6e<code>attributeType<\/code>\u503c\uff0c\u76f4\u63a5\u8ba9\u6d4f\u89c8\u5668\u81ea\u5df1\u53bb\u5224\u65ad\uff0c\u51e0\u4e4e\u65e0\u5dee\u9519\u3002 <\/p>\n<p>\u4e0d\u77e5\u5927\u5bb6\u6709\u6ca1\u6709\u548c\u6211\u4e00\u6837\u7684\u7591\u95ee\uff1a\u201c\u65e2\u7136\u6d4f\u89c8\u5668\u9171\u53ef\u4ee5\u81ea\u5df1\u5224\u65ad\u5c5e\u6027\u7c7b\u522b\uff0c\u90a3\u8fd9\u4e2a\u5c5e\u6027\u8fd8\u6709\u4ec0\u4e48\u610f\u4e49\u5417\uff1f\u201d\u6211\u7422\u78e8\u7740\uff0c\u53ef\u80fd\u67d0\u4e9b\u5c5e\u6027\uff0cXML\u80fd\u5176\u4f5c\u7528\uff0cCSS\u4e5f\u80fd\u5176\u4f5c\u7528\uff0c\u4f8b\u5982<code>font-size<\/code>, \u6b64\u65f6\u5c31\u9700\u8981\u660e\u786e\u4e0b\u5f52\u5c5e\u3002<\/p>\n<p><strong>3. from, to, by, values<\/strong><br \/>\n\u4e0a\u97624\u4e2a\u5c5e\u6027\u662f\u4e00\u4e2a\u5bb6\u65cf\u7684\uff0c\u662f\u6700\u5177\u54f2\u7406\u7684\u4e00\u4e2a\u5bb6\u65cf\u3002\u4ed6\u4eec\u89e3\u51b3\u7684\u662f\u975e\u5e38\u6709\u54f2\u7406\u7684\u95ee\u9898\uff1a\u4f60\u4ece\u54ea\u91cc\u6765\uff1f\u8981\u5230\u54ea\u91cc\u53bb\uff1f\u2026\u2026<\/p>\n<dl>\n<dt><a name=\"FromAttribute\"><\/a>from <span class=\"argvalue\">= &#8220;<strong>&lt;value&gt;<\/strong>&#8220;<\/span><\/dt>\n<dd>\u52a8\u753b\u7684\u8d77\u59cb\u503c\u3002<\/dd>\n<dt><a name=\"ToAttribute\"><\/a>to <span class=\"argvalue\">= &#8220;<strong>&lt;value&gt;<\/strong>&#8220;<\/span><\/dt>\n<dd>\u6307\u5b9a\u52a8\u753b\u7684\u7ed3\u675f\u503c\u3002<\/dd>\n<dt><a name=\"ByAttribute\"><\/a>by <span class=\"argvalue\">= &#8220;<strong>&lt;value&gt;<\/strong>&#8220;<\/span><\/dt>\n<dd>\u52a8\u753b\u7684\u76f8\u5bf9\u53d8\u5316\u503c\u3002<\/dd>\n<dt><a name=\"ValuesAttribute\"><\/a>values <span class=\"argvalue\">= &#8220;<strong>&lt;list&gt;<\/strong>&#8220;<\/span><\/dt>\n<dd>\u7528\u5206\u53f7\u5206\u9694\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u503c\uff0c\u53ef\u4ee5\u770b\u51fa\u662f\u52a8\u753b\u7684\u591a\u4e2a\u5173\u952e\u503c\u70b9\u3002<\/dd>\n<\/dl>\n<p><code>from<\/code>, <code>to<\/code>, <code>by<\/code>, <code>values<\/code>\u867d\u7136\u5c5e\u4e8e\u4e00\u4e2a\u5bb6\u65cf\uff0c\u4f46\u662f\u76f8\u4e92\u4e4b\u95f4\u8fd8\u662f\u6709\u5236\u7ea6\u5173\u7cfb\u7684\u3002\u6709\u4ee5\u4e0b\u4e00\u4e9b\u89c4\u5219\uff1a<br \/>\n<strong>a. <\/strong> \u5982\u679c\u52a8\u753b\u7684\u8d77\u59cb\u503c\u4e0e\u5143\u7d20\u7684\u9ed8\u8ba4\u503c\u662f\u4e00\u6837\u7684\uff0c<code>from<\/code>\u53c2\u6570\u53ef\u4ee5\u7701\u7565\u3002<br \/>\n<strong>b. <\/strong> \uff08\u4e0d\u8003\u8651<code>values<\/code>\uff09<code>to<\/code>,<code>by<\/code>\u4e24\u4e2a\u53c2\u6570\u81f3\u5c11\u9700\u8981\u6709\u4e00\u4e2a\u51fa\u73b0\u3002\u5426\u5219\u52a8\u753b\u6548\u679c\u6ca1\u6709\u3002<code>to<\/code>\u8868\u793a\u7edd\u5bf9\u503c\uff0c<code>by<\/code>\u8868\u793a\u76f8\u5bf9\u503c\u3002\u62ff\u4f4d\u79fb\u8ddd\u79bb\uff0c\u5982\u679c<code>from<\/code>\u662f<code>100<\/code>, <code>to<\/code>\u503c\u4e3a<code>160<\/code>\u5219\u8868\u793a\u79fb\u52a8\u5230<code>160<\/code>\u8fd9\u4e2a\u4f4d\u7f6e\uff0c\u4f46\u662f\uff0c\u5982\u679c<code>by<\/code>\u503c\u662f<code>160<\/code>\uff0c\u5219\u8868\u793a\u79fb\u52a8\u5230<code>100+160=260<\/code>\u8fd9\u4e2a\u4f4d\u7f6e\u3002<br \/>\n<strong>c. <\/strong> \u5982\u679c<code>to<\/code>,<code>by<\/code>\u540c\u65f6\u51fa\u73b0\uff0c\u5219<code>by<\/code>\u6253\u9171\u6cb9\uff0c\u53ea\u8bc6\u522b<code>to<\/code>.<br \/>\n<strong>d. <\/strong> \u5982\u679c<code>to<\/code>,<code>by<\/code>,<code>values<\/code>\u90fd\u6ca1\u8bbe\u7f6e\uff0c\u81ea\u7136\u6ca1\u52a8\u753b\u6548\u679c\u3002\u5982\u679c\u4efb\u610f\uff08\u5305\u62ec<code>from<\/code>\uff09\u4e00\u4e2a\u5c5e\u6027\u7684\u503c\u4e0d\u5408\u6cd5\uff0c\u89c4\u8303\u4e0a\u8bf4\u662f\u6ca1\u6709\u52a8\u753b\u6548\u679c\u3002\u4f46\u662f\uff0c\u636e\u6211\u6d4b\u8bd5\uff0cFireFox\u6d4f\u89c8\u5668\u786e\u5b9e\u5982\u6b64\uff0c\u4f46\u662fChrome\u7279\u610f\u505a\u4e86\u5199\u5bb9\u9519\u5904\u7406\u3002\u4f8b\u5982\uff0c\u672c\u6765\u662f\u6570\u503c\u7684\u5c5e\u6027\uff0c\u5199\u4e86\u4e2a\u8bf8\u5982<code>a<\/code>\u8fd9\u4e2a\u4e0d\u5408\u6cd5\u7684\u503c\uff0c\u5176\u4f1a\u5f53\u4f5c<code>0<\/code>\u6765\u5904\u7406\uff0c\u52a8\u753b\u6548\u679c\u4f9d\u7136\u5b58\u5728\u3002<br \/>\n<strong>e. <\/strong> <code>values<\/code>\u53ef\u4ee5\u662f\u4e00\u4e2a\u503c\u6216\u591a\u503c\u3002\u6839\u636e\u6211\u5728Chrome\u6d4f\u89c8\u5668\u4e0b\u7684\u6d4b\u8bd5\uff0c\u662f\u4e00\u4e2a\u503c\u7684\u65f6\u5019\u662f\u6ca1\u6709\u52a8\u753b\u6548\u679c\u3002\u591a\u503c\u65f6\u5019\u6709\u52a8\u753b\u6548\u679c\u3002\u5f53<code>values<\/code>\u503c\u8bbe\u7f6e\u5e76\u80fd\u8bc6\u522b\u65f6\u5019\uff0c<code>from<\/code>, <code>to<\/code>, <code>by<\/code>\u7684\u503c\u90fd\u4f1a\u88ab\u5ffd\u7565\u3002\u90a3<code>values<\/code>\u5c5e\u6027\u662f\u5e72\u4ec0\u4e48\u7684\u5462\uff1f\u522b\u770b\u540d\u5b57\u633a\u5927\u4f17\u7684\uff0c\u5176\u8fd8\u662f\u6709\u4e9b\u529f\u529b\u7684\u3002\u6211\u4eec\u5b9e\u73b0\u52a8\u753b\uff0c\u4e0d\u53ef\u80fd\u5c31\u662f\u5355\u7eaf\u7684\u4ecea\u4f4d\u7f6e\u5230b\u4f4d\u7f6e\uff0c\u6709\u65f6\u5019\uff0c\u9700\u8981\u53bbc\u4f4d\u7f6e\u8fc7\u6e21\u4e0b\u3002\u6b64\u65f6\uff0c\u5b9e\u9645\u4e0a\u67093\u4e2a\u52a8\u753b\u5173\u952e\u70b9\u3002\u800c<code>from<\/code>, <code>to<\/code>\/<code>by<\/code>\u53ea\u80fd\u9a7e\u9a6d\u4e24\u4e2a\uff0c\u6b64\u65f6\u5c31\u662f<code>values<\/code>\u5927\u663e\u8eab\u624b\u7684\u65f6\u5019\u4e86\uff01\u4f8b\u5982\u4e0b\u9762\u8fd9\u4e2a\u806a\u660e\u7684\u9a6c\u513f\u6765\u56de\u8dd1\u7684\u6548\u679c\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-values.svg\" target=\"_blank\">horse-values.svg<\/a>\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-values.svg\" width=\"320\" height=\"200\" alt=\"\u9a6c\u513f\u6765\u56de\u8dd1\" class=\"mt10\"><\/p>\n<p>\u76f8\u5173SVG\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"150\" x=\"160\">\r\n        \u9a6c\r\n        &lt;animate attributeName=\"x\" <span style=\"color:#cd0000;\">values=\"160;40;160\"<\/span> dur=\"3s\" repeatCount=\"indefinite\" \/>\r\n    &lt;\/text>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u603b\u7ed3\u4e0b\uff0c\u4e5f\u5c31\u662f<code>from-to<\/code>\u52a8\u753b\u3001<code>from-by<\/code>\u52a8\u753b\u3001<code>to<\/code>\u52a8\u753b\u3001<code>by<\/code>\u52a8\u753b\u4ee5\u53ca<code>values<\/code>\u52a8\u753b\u3002<\/p>\n<p><strong>4. begin, end<\/strong><br \/>\n<code>begin<\/code>\u6307\u52a8\u753b\u5f00\u59cb\u7684\u65f6\u95f4\uff0c\u770b\u4e0a\u53bb\u5f88\u7b80\u5355\u3002\u8bbe\u4e2a\u65f6\u95f4\uff0c\u5ef6\u8fdf\u561b~~\u5b9e\u9645\u4e0a\u975e\u4e5f\u975e\u4e5f\uff0c\u4e0a\u9762\u51fa\u73b0\u7684<code>beigin=\"3s\"<\/code>\u53ea\u662f\u6700\u7b80\u5355\u6700\u57fa\u672c\u7684\u8868\u793a\u3002<\/p>\n<p><code>begin<\/code>\u7684\u5b9a\u4e49\u662f\u5206\u53f7\u5206\u9694\u7684\u4e00\u7ec4\u503c\u3002\u770b\u5230\u6ca1\uff1f\u662f\u4e00\u7ec4\u503c\uff0c\u5355\u503c\u53ea\u662f\u5176\u4e2d\u7684\u60c5\u51b5\u4e4b\u4e00\u3002\u4f8b\u5982\uff0c<code>beigin=\"3s;5s\"<\/code>\u8868\u793a\u7684\u662f<code>3s<\/code>\u4e4b\u540e\u52a8\u753b\u8d70\u4e00\u4e0b\uff0c<code>6s<\/code>\u65f6\u5019\u52a8\u753b\u518d\u8d70\u4e00\u4e0b\uff08\u5982\u679c\u4e4b\u524d\u52a8\u753b\u6ca1\u8d70\u5b8c\uff0c\u4f1a\u7acb\u5373\u505c\u6b62\u4ece\u5934\u5f00\u59cb\uff09\u3002\u6240\u4ee5\uff0c\u5982\u679c\u4e00\u6b21\u52a8\u753b\u65f6\u95f4\u4e3a<code>3s<\/code>, \u5373<code>dur=\"3s\"<\/code>\uff0c\u540c\u65f6\u6ca1\u6709<code>repeatCount<\/code>\u5c5e\u6027\u65f6\u5019\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u52a8\u753b\u4f3c\u4e4e\u8fde\u7eed\u6267\u884c\u4e86<code>2<\/code>\u6b21\u3002<\/p>\n<p><strong>\u65f6\u95f4\u503c<\/strong><br \/>\n\u65e2\u7136\u8fd9\u91cc\u63d0\u5230\u4e86\u65f6\u95f4\uff0c\u5c31\u987a\u52bf\u8bb2\u7b80\u5355\u4e00\u4e0bSVG animation\u4e2d\u7684\u65f6\u95f4\u8868\u793a(\u4e5f\u9002\u7528\u4e8e<code>dur<\/code>, <code>end<\/code>\u5c5e\u6027)\u3002\u5e38\u89c1\u5355\u4f4d\u6709 <code>\"h\"<\/code>|<code>\"min\"<\/code>|<code>\"s\"<\/code>|<code>\"ms\"<\/code><\/p>\n<p>\u65f6\u95f4\u503c\u652f\u6301\u7684\u683c\u5f0f\u548c\u89c4\u5219\u76f8\u5f53\u590d\u6742\uff0c\u4f8b\u5982\u6211\u6211\u89c4\u8303\u4e0a\u770b\u5230\u8fd9\u4e2a\uff1a<code>1997-07-16T19:20:30.45+01:00<\/code>. \u4ee5\u53ca\u6d0b\u6d0b\u6d12\u6d12N\u591a\u770b\u4e0d\u61c2\u7684\u793a\u610f\u3002\u5c3c\u739b\uff0c\u8fd9\u4e2a\u8981\u901a\u900f\u6211\u5468\u672b\u9493\u9c7c\u65f6\u95f4\u90fd\u6ca1\u4e86\uff0c\u5173\u952e\u662f\u6ca1\u6709\u5fc5\u8981\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u8fd8\u662f\u4e86\u89e3\u4e0b\u6700\u5e38\u89c1\u7684\u57fa\u672c\u4f7f\u7528\u3002<\/p>\n<p>\u4e0a\u9762\u7684\u5355\u4f4d\u542b\u4e49\u90fd\u662f\u82f1\u6587\u5355\u4f4d\u7684\u7f29\u5199\u3002\u4f8b\u5982<code>h<\/code>\u8868\u793a\u5c0f\u65f6(hour). <\/p>\n<p>\u65f6\u95f4\u503c\u652f\u6301\u5c0f\u6570\u5199\u6cd5\uff0c\u56e0\u6b64\uff0c<code>90s<\/code>\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528<code>1.5miu<\/code>\u8868\u793a\u3002\u65f6\u95f4\u503c\u8fd8\u652f\u6301<code>hh:mm:ss<\/code>\u8fd9\u79cd\u5199\u6cd5\uff0c\u56e0\u6b64\uff0c<code>90s<\/code>\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528<code>01:30<\/code>\u8868\u793a\u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u70b9\uff0c\u5341\u8fdb\u5236\u7684\u5c0f\u6570\u503c\u662f\u79d2\u7684\u6d6e\u70b9\u5b9a\u4e49\u3002\u4ec0\u4e48\u610f\u601d\u5462\uff1f\u5c31\u662f\u5982\u679c<code>begin=\"1.5\"<\/code>\u6ca1\u6709\u5355\u4f4d\uff0c\u8fd9\u91cc\u7684\u5c0f\u6570\u70b9\u8868\u793a\u79d2\uff0c\u4e5f\u5c31\u662f<code>1.5s<\/code>\u7684\u610f\u601d\u3002\u6240\u4ee5\uff0c\u4e0a\u9762N\u6b21\u51fa\u73b0\u7684<code>beigin=\"3s\"<\/code>\u4e5f\u53ef\u4ee5\u7b80\u5199\u4f5c<code>beigin=\"3\"<\/code>. \u6211\u6d4b\u4e86\u4e0b\uff0cFireFox\u548cChrome\u6d4f\u89c8\u5668\u90fd\u662f\u652f\u6301\u7684\u3002<\/p>\n<p><code>begin<\/code>\u7684\u5355\u503c\u9664\u4e86\u666e\u901avalue\uff0c\u8fd8\u6709\u4e0b\u9762\u8fd9\u4e9b\u7c7b\u522b\u7684value\uff1a<br \/>\n<code>offset-value<\/code> | <code>syncbase-value<\/code> | <code>event-value<\/code> | <code>repeat-value<\/code> | <code>accessKey-value<\/code> | <code>media-marker-value<\/code> | <code>wallclock-sync-value<\/code> | <code>\"indefinite\"<\/code> <\/p>\n<p>\u2460 <code>offset-value<\/code>\u8868\u793a\u504f\u79fb\u503c\uff0c\u6570\u503c\u524d\u9762\u6709<code>+<\/code>\u6216<code>-<\/code>. \u5e94\u8be5\u6307\u76f8\u5bf9\u4e8edocumentdocument\u7684<code>begin<\/code>\u503c\u800c\u8a00\u3002<br \/>\n\u2461 <code>syncbase-value<\/code>\u57fa\u4e8e\u540c\u6b65\u786e\u5b9a\u7684\u503c\u3002\u8bed\u6cd5\u4e3a\uff1a<code>[\u5143\u7d20\u7684id].begin\/end +\/- \u65f6\u95f4\u503c<\/code>. \u5c31\u662f\u8bf4\u501f\u7528\u5176\u4ed6\u5143\u7d20\u7684begin\u503c\u518d\u52a0\u52a0\u51cf\u51cf\uff0c\u8fd9\u4e2a\u53ef\u4ee5\u51c6\u786e\u5b9e\u73b0\u4e24\u4e2a\u72ec\u7acb\u5143\u7d20\u7684\u52a8\u753b\u7ea7\u8054\u6548\u679c\u3002OK\uff0c\u770b\u5b8c\u4e0b\u9762\u7684\u4f8b\u5b50\u4e00\u5b9a\u4f1a\u8c41\u7136\u5f00\u6717\uff0c\u5bf9\u4e8e\u4e0a\u9762\u7684<code>offset-value<\/code>\u4e5f\u4f1a\u6709\u4e00\u5b9a\u7684\u8ba4\u77e5\u3002<\/p>\n<p>\u8fd9\u6837\u7684\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c\r\n        &lt;animate id=\"x\" attributeName=\"x\" to=\"60\" begin=\"0s\" dur=\"3s\" fill=\"freeze\" \/>\r\n        &lt;animate attributeName=\"y\" to=\"100\" <span style=\"color:#cd0000;\">begin=\"x.end\"<\/span> dur=\"3s\" fill=\"freeze\" \/>\r\n    &lt;\/text>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u4e8e\u662f\uff0c\u5b9e\u73b0\u4e86\u4e00\u4e2a\u9a6c\u513f\u6298\u7ebf\u8dd1\u7684\u6548\u679c\uff0c\u5148\u6a2a\u5411\u79fb\u52a8\uff0c\u518d\u65e0\u7f1d\u7eb5\u5411\u79fb\u52a8\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-animate-x-y.svg\" target=\"_blank\">horse-animate-x-y.svg<\/a>\uff09\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-animate-x-y.svg\" width=\"320\" height=\"200\" alt=\"\u9a6c\u513f\u6298\u7ebf\u8dd1\" class=\"mt10\"><\/p>\n<p>\u5982\u679c\u60a8\u53d1\u73b0\u6ca1\u6709\u6548\u679c\uff0c\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e2d\u663e\u793aSVG\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/201408\/horse-animate-x-y.svg\" target=\"_blank\">horse-animate-x-y.svg<\/a><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u540e\u9762<code>attributeName<\/code>\u4e3a<code>y<\/code>\u7684\u5143\u7d20\u7684<code>begin<\/code>\u503c\u662f<code>x.end<\/code>. <code>x.end<\/code>\u4e2d\u7684<code>x<\/code>\u5c31\u662f\u4e0a\u9762\u4e00\u4e2a<code>animate<\/code>\u5143\u7d20\u7684<code>id<\/code>\u503c\uff0c\u800c<code>end<\/code>\u662f\u52a8\u753b\u5143\u7d20\u90fd\u6709\u7684\u4e00\u4e2a\u5c5e\u6027\uff0c\u52a8\u753b\u7ed3\u675f\u7684\u65f6\u95f4\u3002\u56e0\u6b64\uff0c<code>begin=\"x.end\"<\/code>\u610f\u601d\u5c31\u662f\uff0c\u5f53<code>id<\/code>\u4e3a<code>x<\/code>\u7684\u5143\u7d20\u52a8\u753b\u7ed3\u675f\u7684\u65f6\u5019\uff0c\u6211\u6267\u884c\u52a8\u753b\u3002\u975e\u5e38\u7c7b\u4f3c\u4e8ePowerPoint\u52a8\u753b\u7684\u201c\u4e0a\u4e00\u4e2a\u52a8\u753b\u4e4b\u540e\u201d\u7684\u9009\u9879\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u589e\u52a0\u4e00\u4e9b\u504f\u79fb\u503c\uff0c\u4f8b\u5982<code>begin=\"x.end-1s\"<\/code>, \u5c31\u8868\u793a<code>id<\/code>\u4e3a<code>x<\/code>\u7684\u5143\u7d20\u52a8\u753b\u7ed3\u675f\u524d\u4e00\u79d2\u5f00\u59cb\u7eb5\u5411\u79fb\u52a8\u3002<\/p>\n<p>\u2462 <code>event-value<\/code>\u8fd9\u4e2a\u8868\u793a\u4e0e\u4e8b\u4ef6\u76f8\u5173\u8054\u7684\u503c\u3002\u7c7b\u4f3c\u4e8ePowerPoint\u52a8\u753b\u7684\u201c\u70b9\u51fb\u6267\u884c\u8be5\u52a8\u753b\u201d\u3002\u8bed\u6cd5\u662f\uff1a<code>[\u5143\u7d20\u7684id].[\u4e8b\u4ef6\u7c7b\u578b] +\/- \u65f6\u95f4\u503c<\/code>. \u4e3e\u4e2a\u4f8b\u5b50\uff0c\u70b9\u51fb\u4e0b\u56fe\u7684\u5706\u5708\u5708\uff0c\u9a6c\u513f\u5b83\u5c31\u4f1a\u81ea\u5df1\u8dd1\uff01<\/p>\n<p><svg width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">      <circle id=\"circle\" cx=\"100\" cy=\"100\" r=\"50\"><\/circle>    <text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">        \u9a6c        <animate attributeName=\"x\" to=\"60\" begin=\"circle.click\" dur=\"3s\" \/>    <\/text><\/svg><\/p>\n<p>SVG\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg id=\"svg\" width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n    &lt;circle id=\"circle\" cx=\"100\" cy=\"100\" r=\"50\">&lt;\/circle>\r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c\r\n        &lt;animate attributeName=\"x\" to=\"60\" <span style=\"color:#cd0000;\">begin=\"circle.click\"<\/span> dur=\"3s\" \/>\r\n    &lt;\/text>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u4ee3\u7801\u7684\u5173\u952e\u70b9\u5c31\u662f\u4e0a\u9762\u7ea2\u8272\u9ad8\u4eae\u7684<code>begin=\"circle.click\"<\/code>, \u5176\u4e2d<code>circle<\/code>\u4e3a<code>circle<\/code>\u5143\u7d20\uff08\u9ed1\u8272\u5706\uff09\u7684<code>id<\/code>, <code>click<\/code>\u8868\u793a\u70b9\u51fb\u4e8b\u4ef6\u3002\u542b\u4e49\u4e00\u76ee\u4e86\u7136\uff0c\u5982\u679c\u4f60\u60f3\u70b9\u51fb\u5706\u5708\u57082\u79d2\u949f\u540e\u9a6c\u513f\u624d\u8dd1\uff0c\u5f88\u7b80\u5355\uff0c\u504f\u79fb\u65f6\u95f4\u52a0\u4e0a\u5c31\u53ef\u4ee5\u4e86\u2014\u2014<code>begin=\"circle.click+2s\"<\/code>.<\/p>\n<p>\u4e3b\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u7c7b\u4e0e\u4e8b\u4ef6\u5173\u8054\u7684SVG\u9700\u8981\u5185\u8054\u5728\u9875\u9762\u4e2d\uff0c\u5426\u5219<code>click<\/code>\u4ec0\u4e48\u7684\u90fd\u662f\u5f92\u52b3\u3002<\/p>\n<p>\u2463 <code>repeat-value<\/code>\u6307\u91cd\u590d\u591a\u5c11\u6b21\u4e4b\u540e\u5e72\u561b\u5e72\u561b\u3002\u8bed\u6cd5\u4e3a\uff1a<code>[\u5143\u7d20\u7684id].repeat(\u6574\u6570) +\/- \u65f6\u95f4\u503c<\/code>. \u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4e0b\u9762\u8fd9\u4e2a\u9a6c\u513f\u4f1a\u5728\u6c34\u5e73\u8fd0\u52a82\u6b21\u4e4b\u540e\uff0c\u659c\u5411\u8fd0\u52a8\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-repeat-value.svg\" target=\"_blank\">horse-repeat-value.svg<\/a>\uff09\u2026\u2026<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-repeat-value.svg\" width=\"320\" height=\"200\" alt=\"\u9a6c\u513f\u8dd1\u4e862\u6b21\u540e\u53d8\u5411\" class=\"mt10\"><\/p>\n<p>SVG\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c\r\n        &lt;animate id=\"x\" attributeName=\"x\" to=\"60\" begin=\"0s\" dur=\"3s\" repeatCount=\"indefinite\" \/>\r\n        &lt;animate attributeName=\"y\" to=\"100\" <span style=\"color:#cd0000;\">begin=\"x.repeat(2)\"<\/span> dur=\"3s\" fill=\"freeze\" \/>\r\n    &lt;\/text>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p><code>begin=\"x.repeat(2)\"<\/code>\u6307<code>id<\/code>\u4e3a<code>x<\/code>\u7684\u5143\u7d20\u7684\u52a8\u753b\u91cd\u590d<code>2<\/code>\u6b21\u540e\u6267\u884c~~<\/p>\n<p>\u2464 <code>accessKey-value<\/code>\u5b9a\u4e49\u5feb\u6377\u952e\u3002\u5373\u6309\u4e0b\u67d0\u4e2a\u6309\u952e\u52a8\u753b\u5f00\u59cb\u3002\u8bed\u6cd5\u4e3a\uff1a<code>accessKey(\" character \")<\/code>. <code>character<\/code>\u8868\u793a\u5feb\u6377\u952e\u6240\u5728\u7684\u5b57\u7b26\uff0c\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u6309\u4e0b<code>s<\/code>\u952e\u52a8\u753b\u8d70\u8d77\u3002SVG\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c\r\n        &lt;animate attributeName=\"x\" to=\"60\" <span style=\"color:#cd0000;\">begin=\"accessKey(s)\"<\/span> dur=\"3s\" repeatCount=\"indefinite\" \/>\r\n    &lt;\/text>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>SVG\u5b9e\u65f6\u663e\u793a\u5982\u4e0b\uff1a<br \/>\n<svg width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c<animate attributeName=\"x\" to=\"60\" begin=\"accessKey(s)\" dur=\"3s\" repeatCount=\"indefinite\" \/><\/text><\/svg><\/p>\n<p>\u6309\u4e0b\u952e\u76d8\u4e0a\u7684\u5b57\u6bcd<code>\"s\"<\/code>, \u7406\u8bba\u4e0a\u52a8\u753b\u5c31\u4f1a\u6267\u884c\u3002\u4f46\u662f\uff0c\u636e\u6211\u6d4b\u8bd5\uff0c\u6211\u7684Chrome\u6d4f\u89c8\u5668\uff08\u7248\u672c36\uff09\u4e0a\u662f\u6ca1\u6709\u6548\u679c\u7684\uff0cFireFox\u6d4f\u89c8\u5668\u6548\u679c\u6760\u6760\u7684\uff01\u6240\u4ee5\uff0c\u5982\u679c\u60a8\u7684\u6d4f\u89c8\u5668\u6ca1\u6709\u6548\u679c\uff0c\u4f46\u662f\u624b\u4e0a\u6709\u706b\u72d0\uff0c\u53ef\u4ee5\u590d\u5236\u4e0b\u9762\u8fd9\u4e2a\u5730\u5740\u53bbFireFox\u6d4f\u89c8\u5668\u4e0b\u611f\u53d7\u4e0b\uff1ahttp:\/\/www.zhangxinxu.com\/study\/201408\/horse-accesskey-value.svg<\/p>\n<p>\u2465 <code>wallclock-sync-value<\/code>\u6307\u771f\u5b9e\u4e16\u754c\u7684\u65f6\u949f\u65f6\u95f4\u5b9a\u4e49\u3002\u65f6\u95f4\u8bed\u6cd5\u662f\u57fa\u4e8e\u5728ISO8601\u4e2d\u5b9a\u4e49\u7684\u8bed\u6cd5\u3002\u4f8b\u5982\u4e0a\u9762\u63d0\u5230\u7684<code>1997-07-16T19:20:30.45+01:00<\/code>\u8fd9\u4e2a\u8ba9\u4eba\u5475\u5475\u5475\u7684\u65f6\u95f4\u8868\u793a\u3002<\/p>\n<p>\u2466 <code>\"indefinite\"<\/code>\u5c31\u662f\u8fd9\u4e2a\u5b57\u7b26\u4e32\u503c\uff0c\u8868\u793a\u201c\u65e0\u9650\u7b49\u5f85\u201d\u3002\u636e\u8bf4\u9700\u8981<code>beginElement()<\/code>\u65b9\u6cd5\u89e6\u53d1\u6216\u8005\u6307\u5411\u8be5\u52a8\u753b\u5143\u7d20\u7684\u8d85\u94fe\u63a5(SVG\u4e2d\u7684<code>a<\/code>\u5143\u7d20)\u3002<br \/>\n\u4e0b\u9762\u4ee3\u7801\u662f<code>beginElement()<\/code>\u65b9\u6cd5\u89e6\u53d1\u7684\u4f8b\u5b50\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg id=\"svg\" width=\"320\" height=\"200\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n    &lt;text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c\r\n        &lt;animate attributeName=\"x\" to=\"60\" <span style=\"color:#cd0000;\">begin=\"indefinite\"<\/a> dur=\"3s\" \/>\r\n    &lt;\/text>\r\n&lt;\/svg><\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>var animate = document.getElementsByTagName(\"animate\")[0];\r\nif (animate) {\r\n    document.getElementById(\"svg\").onclick = function() {\r\n        <span style=\"color:#cd0000;\">animate.beginElement();<\/spen>\r\n    };\r\n}<\/pre>\n<\/div>\n<p>\u4e0a\u9762\u662fHTML\u4ee3\u7801\uff0c\u4e0b\u9762\u662fJS\u4ee3\u7801\u3002\u610f\u601d\u5f88\u7b80\u5355\uff0c\u70b9\u51fb\u6211\u4eec\u7684<code>svg<\/code>, \u89e6\u53d1<code>animate<\/code>\u5143\u7d20\u7684<code>beginElement()<\/code>\u65b9\u6cd5\uff0c\u524d\u63d0\u662f<code>begin=\"indefinite\"<\/code>. \u7531\u4e8e\u7275\u626fJS, \u6587\u7ae0\u9875\u62d8\u8c28\u4e86\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/201408\/svg-animation-beginelement.html\" target=\"_blank\">beginElement()\u65b9\u6cd5\u89e6\u53d1SVG\u52a8\u753bdemo<\/a><\/p>\n<p>\u8d85\u94fe\u63a5\u89e6\u53d1\u7684\u4f8b\u5b50\u53c2\u89c1\u4e0b\u9762\uff1a<br \/>\n<svg width=\"320\" height=\"200\" font-family=\"microsoft yahei\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\"> <text font-size=\"120\" y=\"160\" x=\"160\">\u9a6c          <animate id=\"animate\" attributeName=\"x\" to=\"60\" begin=\"indefinite\" dur=\"3s\" repeatCount=\"indefinite\" \/>     <\/text>\t <a xlink:href=\"#animate\">          <text x=\"10\" y=\"20\" fill=\"#cd0000\" font-size=\"20\">\u70b9\u51fb\u6211<\/text>     <\/a><\/svg><\/p>\n<p>SVG\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;svg width=\"320\" height=\"200\" font-family=\"microsoft yahei\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\">\r\n     &lt;text font-size=\"120\" y=\"160\" x=\"160\">\u9a6c\r\n          &lt;animate id=\"animate\" attributeName=\"x\" to=\"60\" <span style=\"color:#cd0000;\">begin=\"indefinite\"<\/span> dur=\"3s\" repeatCount=\"indefinite\" \/>\r\n     &lt;\/text>\r\n     &lt;a xlink:href=\"#animate\">\r\n          &lt;text x=\"10\" y=\"20\" fill=\"#cd0000\" font-size=\"30\">\u70b9\u51fb\u6211&lt;\/text>\r\n     &lt;\/a>\r\n&lt;\/svg><\/pre>\n<\/div>\n<p>\u4ece\u4e0a\u9762\u4ee3\u7801\u53ef\u4ee5\u770b\u51fa\uff0c\u52a8\u753b\u89e6\u53d1\u6761\u4ef6\u5f88\u7b80\u5355\uff0c\u53ea\u8981<code>a<\/code>\u5143\u7d20\u7684<code>xlink:href<\/code>\u6307\u5411\u7684\u6211\u4eec\u7684\u52a8\u753b\u5143\u7d20\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u5982\u679c\u4e0a\u9762SVG\u6ca1\u6548\u679c\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u70b9\u51fb\u8fd9\u91cc\u76f4\u63a5\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/201408\/horse-begin-link.svg\" target=\"_blank\">horse-begin-link.svg<\/a><\/p>\n<p>\u6700\u540e\uff0c\u641e\u4e00\u6bb5\u89c4\u8303\u4e0a\u51fa\u73b0\u7684\u4e00\u6bb5\u6587\u5b57\uff1a<\/p>\n<blockquote><p>If no begin is specified, the default value is &#8220;0&#8221; &#8211; the animation begins when the document begins. If there is any error in the argument value syntax for begin, the default value for begin will be used.<\/p><\/blockquote>\n<p>\u610f\u601d\u662f\uff0c\u6ca1\u6709<code>begin<\/code>\u6216\u8005<code>begin<\/code>\u53c2\u6570\u89e3\u6790\u5f02\u5e38\uff0c\u90fd\u5f53\u4f5c<code>0<\/code>\u5904\u7406\u3002<\/p>\n<p>\u8bf4\u5230\u73b0\u5728\u57fa\u672c\u4e0a\u90fd\u662f<code>begin<\/code>\u5c5e\u6027\uff0c\u5b9e\u9645\u4e0a<code>end<\/code>\u4e0e<code>begin<\/code>\u9664\u4e86\u540d\u5b57\u548c\u5b57\u9762\u542b\u4e49\u4e0d\u4e00\u6837\uff0c\u5176\u503c\u7684\u79cd\u7c7b\u4e0e\u8868\u610f\u90fd\u662f\u4e00\u6a21\u4e00\u6837\u7684\uff0c\u6211\u8fd9\u91cc\u5c31\u4e0d\u91cd\u590d\u5570\u55e6\u4e86\u3002<\/p>\n<p><strong>5. dur<\/strong><br \/>\n<code>dur<\/code>\u5c5e\u6027\u503c\u6bd4<code>begin<\/code>\u7b80\u5355\u4e86\u597d\u51e0\u5c42\u697c\uff0c\u5c31\u540e\u9762\u4e24\u79cd\uff1a\u5e38\u89c4\u65f6\u95f4\u503c | <code>\"indefinite\"<\/code>.<\/p>\n<p>\u201c\u5e38\u89c4\u65f6\u95f4\u503c\u201d\u5c31\u662f<code>3s<\/code>\u4e4b\u7c7b\u7684\u6b63\u5e38\u503c\uff1b<code>\"indefinite\"<\/code>\u6307\u4e8b\u4ef6\u65e0\u9650\u3002\u8bd5\u60f3\u4e0b\uff0c\u52a8\u753b\u65f6\u95f4\u65e0\u9650\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f\u52a8\u753b\u538b\u6839\u4e0d\u6267\u884c\u7684\u610f\u601d\u3002\u56e0\u6b64\uff0c\u8bbe\u7f6e\u4e3a<code>\"indefinite\"<\/code>\u8ddf\u6ca1\u6709<code>dur<\/code>\u662f\u4e00\u4e2a\u610f\u601d\uff0c\u4e0e<code>dur<\/code>\u89e3\u6790\u5f02\u5e38\u4e00\u4e2a\u610f\u601d\u3002<\/p>\n<p><strong>6. calcMode, keyTimes, keySplines<\/strong><br \/>\n\u8fd9\u51e0\u4e2a\u53c2\u6570\u662f\u63a7\u5236\u52a8\u753b\u5148\u5feb\u8fd8\u662f\u5148\u6162\u7c7b\u4f3c\u8fd9\u6837\u4f5c\u7528\u7684\u3002<\/p>\n<p><code>calcMode<\/code>\u5c5e\u6027\u652f\u63014\u4e2a\u503c\uff1a<code>discrete<\/code> | <code>linear<\/code> | <code>paced<\/code> | <code>spline<\/code>. \u4e2d\u6587\u610f\u601d\u5206\u522b\u662f\uff1a\u201c\u79bb\u6563\u201d|\u201c\u7ebf\u6027\u201d|\u201c\u8e0f\u6b65\u201d|\u201c\u6837\u6761\u201d\u3002<\/p>\n<dl>\n<dt>discrete<\/dt>\n<dd><code>from<\/code>\u503c\u76f4\u63a5\u8df3\u5230<code>to<\/code>\u503c\u3002<\/dd>\n<dt>linear<\/dt>\n<dd>animateMotion\u5143\u7d20\u4ee5\u5916\u5143\u7d20\u7684<code>calcMode<\/code>\u9ed8\u8ba4\u503c\u3002\u52a8\u753b\u4ece\u5934\u5230\u5c3e\u7684\u901f\u7387\u90fd\u662f\u4e00\u81f4\u7684\u3002<\/dd>\n<dt>paced<\/dt>\n<dd>\u901a\u8fc7\u63d2\u503c\u8ba9\u52a8\u753b\u7684\u53d8\u5316\u6b65\u8c03\u5e73\u7a33\u5747\u5300\u3002\u4ec5\u652f\u6301\u7ebf\u6027\u6570\u503c\u533a\u57df\u5185\u7684\u503c\uff0c\u8fd9\u6837\u70b9\u4e4b\u95f4\u201c\u8ddd\u79bb\u201d\u7684\u6982\u5ff5\u624d\u80fd\u88ab\u8ba1\u7b97\uff08\u5982<code>position<\/code>, <code>width<\/code>, <code>height<\/code>\u7b49\uff09\u3002\u5982\u679c&#8221;<code>paced<\/code>&#8220;\u6307\u5b9a\uff0c\u4efb\u4f55<code>keyTimes<\/code>\u6216<code>keySplines<\/code>\u503c\u90fd\u4f1a\u6253\u9171\u6cb9\u3002<\/dd>\n<dt>spline<\/dt>\n<dd>\u63d2\u503c\u5b9a\u4e49\u8d1d\u585e\u5c14\u66f2\u7ebf\u3002<code>spline<\/code>\u70b9\u7684\u5b9a\u4e49\u5728<code>keyTimes<\/code>\u5c5e\u6027\u4e2d\uff0c\u6bcf\u4e2a\u65f6\u95f4\u95f4\u9694\u63a7\u5236\u70b9\u7531<code>keySplines<\/code>\u5b9a\u4e49\u3002<\/dd>\n<\/dl>\n<p><strong>keyTimes = &#8220;&lt;list>&#8221;<\/strong><br \/>\n\u8ddf\u4e0a\u9762\u63d0\u5230\u7684<code>&lt;list&gt;<\/code>\u7c7b\u4f3c\uff0c\u90fd\u662f\u5206\u53f7\u5206\u9694\u4e00\u7ec4\u503c\u3002<code>keyTimes<\/code>\u603b\u540d\u5b57\u4e0a\u770b\u662f\u5173\u952e\u65f6\u95f4\u70b9\u7684\u610f\u601d\uff0c\u5927\u81f4\u5c31\u662f\u8fd9\u4e2a\u610f\u601d\u3002\u524d\u9762\u63d0\u5230\u8fc7<code>values<\/code>\u4e5f\u662f\u591a\u503c\uff0c\u8fd9\u91cc\u6709\u4e00\u4e9b\u7ea6\u5b9a\u7684\u89c4\u5219\uff1a\u9996\u5148\uff0c<code>keyTimes<\/code>\u503c\u7684\u6570\u76ee\u8981\u548c<code>values<\/code>\u4e00\u81f4\uff0c\u5982\u679c\u662f<code>from\/to\/by<\/code>\u52a8\u753b\uff0c<code>keyTimes<\/code>\u5c31\u5fc5\u987b\u6709\u4e24\u4e2a\u503c\u3002\u7136\u540e\u5bf9\u4e8e<code>linear<\/code>\u548c<code>spline<\/code>\u52a8\u753b\uff0c\u7b2c\u4e00\u4e2a\u6570\u5b57\u8981\u662f<code>0<\/code>, \u6700\u540e\u4e00\u4e2a\u662f<code>1<\/code>\u3002 \u6700\u540e\uff0c\u6bcf\u4e2a\u8fde\u7eed\u7684\u65f6\u95f4\u503c\u5fc5\u987b\u6bd4\u5b83\u524d\u9762\u7684\u503c\u5927\u6216\u8005\u76f8\u7b49\u3002<\/p>\n<p><code>paced<\/code>\u6a21\u5f0f\u4e0b\uff0c<code>keyTimes<\/code>\u4f1a\u88ab\u5ffd\u7565\uff1b<code>keyTimes<\/code>\u5b9a\u4e49\u9519\u8bef\uff0c\u4e5f\u4f1a\u88ab\u5ffd\u7565\uff1b<code>dur<\/code>\u4e3a<code>indefinite<\/code>\u4e5f\u4f1a\u88ab\u5ffd\u7565\u3002<\/p>\n<p><strong>keySplines = &#8220;&lt;list>&#8221;<\/strong><br \/>\n<code>keySplines<\/code>\u8868\u793a\u7684\u662f\u4e0e<code>keyTimes<\/code>\u76f8\u5173\u8054\u7684\u4e00\u7ec4\u8d1d\u585e\u5c14\u63a7\u5236\u70b9\uff08\u9ed8\u8ba4<code>0 0 1 1<\/code>\uff09\u3002\u6bcf\u4e2a\u63a7\u5236\u70b9\u4f7f\u75284\u4e2a\u6d6e\u70b9\u503c\u8868\u793a\uff1a<code>x1 y1 x2 y2<\/code>. \u53ea\u6709\u6a21\u5f0f\u662f<code>spline<\/code>\u65f6\u5019\u8fd9\u4e2a\u53c2\u6570\u624d\u6709\u7528\uff0c\u4e5f\u662f\u5206\u53f7\u5206\u9694\uff0c\u503c\u8303\u56f4<code>0~1<\/code>\uff0c\u603b\u662f\u6bd4<code>keyTimes<\/code>\u5c11\u4e00\u4e2a\u503c\u3002<\/p>\n<p>\u5982\u679c<code>keySplines<\/code>\u503c\u4e0d\u5408\u6cd5\u6216\u4e2a\u6570\u4e0d\u5bf9\uff0c\u662f\u6ca1\u6709\u52a8\u753b\u6548\u679c\u7684\u3002<\/p>\n<p>\u53e8\u53e8\u8fd9\u4e48\u591a\uff0c\u89c4\u8303\u7684\u672f\u8bed\u8fd8\u771f\u662f\u62d7\u53e3\uff0c\u4e0d\u6025\uff0c\u6211\u4eec\u5148\u611f\u53d7\u4f8b\u5b50\uff0c\u7136\u540e\u518d\u7ed9\u5927\u5bb6\u901a\u4fd7\u89e3\u91ca\uff1a<br \/>\n\u5982\u4e0b4\u4e2aSVG\uff0c\u53ea\u5c55\u793a\u91cd\u8981\u90e8\u5206\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;animate attributeName=\"x\" dur=\"5s\" values=\"0; 20; 160\" calcMode=\"linear\" \/><\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>&lt;animate attributeName=\"x\" dur=\"5s\" values=\"0; 20; 160\" calcMode=\"paced\"\/><\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>&lt;animate attributeName=\"x\" dur=\"5s\" values=\"0; 80; 160\" keyTimes=\"0; .8; 1\" calcMode=\"linear\"\/><\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>&lt;animate attributeName=\"x\" dur=\"5s\" values=\"0; 80; 160\" keyTimes=\"0; .8; 1\" calcMode=\"spline\"  keySplines=\".5 0 .5 1; 0 0 1 1\" \/><\/pre>\n<\/div>\n<p>\u5176\u6548\u679c\u4e3a\u2026\u2026\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/201408\/svg-animation-calcmode.html\" target=\"_blank\">calcMode, keyTimes, keySplines\u5c5e\u6027demo<\/a><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\u52304\u5339\u9a6c\u4e0a\u534a\u9014\u4e2d\u4f60\u8ffd\u6211\u8d76\u7684\u7ecf\u5e38\u573a\u9762\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201408\/2014-08-31_015731.png\" width=\"542\" height=\"470\" alt=\"\u56db\u67b6\u9a6c\u8f66\u622a\u56fe\" class=\"alignnone\" \/><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"10\"><\/td>\n<td width=\"172\"><img loading=\"lazy\" decoding=\"async\" alt=\"Example keySplines01 - keySplines of 0 0 1 1 (the default)\" width=\"172\" height=\"174\" src=\"http:\/\/www.w3.org\/TR\/2001\/REC-smil-animation-20010904\/interpSpline01.png\"> <span style=\"FONT-STYLE: italic; TEXT-ALIGN: center\">keySplines=&#8221;0&nbsp;0&nbsp;1&nbsp;1&#8243;<br \/>\n        (the default)<\/span><\/td>\n<td width=\"20\"><\/td>\n<td width=\"172\"><img loading=\"lazy\" decoding=\"async\" alt=\"Example keySplines02 - keySplines of .5 0 .5 1\" src=\"http:\/\/www.w3.org\/TR\/2001\/REC-smil-animation-20010904\/interpSpline02.png\" width=\"172\" height=\"174\"> <span style=\"FONT-STYLE: italic; TEXT-ALIGN: center\">keySplines=&#8221;.5&nbsp;0&nbsp;.5&nbsp;1&#8243;<br \/>\n        &nbsp;<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"10\"><\/td>\n<td width=\"172\"><img loading=\"lazy\" decoding=\"async\" alt=\"Example keySplines03 - keySplines of 0 .75 .25 1\" src=\"http:\/\/www.w3.org\/TR\/2001\/REC-smil-animation-20010904\/interpSpline03.png\" width=\"172\" height=\"174\"> <span style=\"FONT-STYLE: italic; TEXT-ALIGN: center\">keySplines=&#8221;0&nbsp;.75&nbsp;.25&nbsp;1&#8243;<\/span><\/td>\n<td width=\"20\"><\/td>\n<td width=\"172\"><img loading=\"lazy\" decoding=\"async\" alt=\"Example keySplines04 - keySplines of 1 0 .25 .25\" src=\"http:\/\/www.w3.org\/TR\/2001\/REC-smil-animation-20010904\/interpSpline04.png\" width=\"172\" height=\"174\"> <span style=\"FONT-STYLE: italic; TEXT-ALIGN: center\">keySplines=&#8221;1&nbsp;0&nbsp;.25&nbsp;.25&#8243;<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u62ff\u6700\u540e\u4e00\u4e2aSVG\u8bf4\u4e8b\u5427\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f<code>values<\/code>, <code>keyTimes<\/code>, <code>keySplines<\/code>\u4e09\u4e2a\u4eba\u4e4b\u95f4\u4e8b\u60c5\u3002<code>values<\/code>\u786e\u5b9a\u52a8\u753b\u7684\u5173\u952e\u4f4d\u7f6e\uff0c<code>keyTimes<\/code>\u786e\u5b9a\u5230\u8fd9\u4e2a\u5173\u952e\u70b9\u9700\u8981\u7684\u65f6\u95f4\uff0c<code>keySplines<\/code>\u786e\u5b9a\u7684\u662f\u6bcf\u4e2a\u65f6\u95f4\u70b9\u6bb5\u4e4b\u95f4\u7684\u8d1d\u585e\u5c14\u66f2\u7ebf\uff0c\u4e5f\u5c31\u662f\u5177\u4f53\u7684\u7f13\u52a8\u8868\u73b0\u3002\u6211\u4eec\u5e73\u65f6CSS3\u5199\u7684<code>transition<\/code>\u52a8\u753b\u6548\u679c\uff0c\u4e5f\u662f\u8fd9\u4e48\u56de\u4e8b\uff0c\u8fd9\u662f<code>values<\/code>\u503c\u5c31\u4e24\u4e2a\uff0c\u6240\u4ee5\uff0c<code>keyTimes<\/code>\u53ea\u80fd\u662f<code>0;1<\/code>, \u8d1d\u585e\u5c14\u66f2\u7ebf\u5c31\u53ea\u6709\u4e00\u4e2a\uff0c\u8981\u4e0d<code>ease<\/code>, \u8981\u4e0d<code>linear<\/code>\u7b49\u3002<\/p>\n<p><strong>7. repeatCount, repeatDur<\/strong><br \/>\n<code>repeatCount<\/code>\u8868\u793a\u52a8\u753b\u6267\u884c\u6b21\u6570\uff0c\u53ef\u4ee5\u662f\u5408\u6cd5\u6570\u503c\u6216\u8005&#8221;<code>indefinite<\/code>&#8220;\uff08\u52a8\u753b\u5faa\u73af\u5230\u7535\u8111\u6b7b\u673a\uff09\u3002<\/p>\n<p><code>repeatDur<\/code>\u5b9a\u4e49\u91cd\u590d\u52a8\u753b\u7684\u603b\u65f6\u95f4\u3002\u53ef\u4ee5\u662f\u666e\u901a\u65f6\u95f4\u503c\u6216\u8005&#8221;<code>indefinite<\/code>\uff08&#8221;\u52a8\u753b\u5faa\u73af\u5230\u7535\u8111\u6b7b\u673a\uff09\u3002<\/p>\n<p>\u4f8b\u5982\u8fd9\u4e2a\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;animate attributeName=\"x\" to=\"60\" dur=\"3s\" repeatCount=\"indefinite\" repeatDur=\"10s\" \/><\/pre>\n<\/div>\n<p>\u52a8\u753b\u53ea\u73a9\u6267\u884c\u5b8c\u6574<code>3<\/code>\u4e2a <code>+<\/code> \u4e00\u4e2a<code>1\/3<\/code>\u4e2a\u52a8\u753b\u3002\u56e0\u4e3arepeat\u603b\u65f6\u95f4\u5c31<code>10s<\/code>\u800c\u5df2\u3002<\/p>\n<p><strong>8. fill<\/strong><br \/>\n<code>fill<\/code>\u8868\u793a\u52a8\u753b\u95f4\u9699\u7684\u586b\u5145\u65b9\u5f0f\u3002\u652f\u6301\u53c2\u6570\u6709\uff1a<code>freeze<\/code> | <code>remove<\/code>. \u5176\u4e2d<code>remove<\/code>\u662f\u9ed8\u8ba4\u503c\uff0c\u8868\u793a\u52a8\u753b\u7ed3\u675f\u76f4\u63a5\u56de\u5230\u5f00\u59cb\u7684\u5730\u65b9\u3002<code>freeze<\/code>\u201c\u51bb\u7ed3\u201d\u8868\u793a\u52a8\u753b\u7ed3\u675f\u540e\u50cf\u662f\u88ab\u51bb\u4f4f\u4e86\uff0c\u5143\u7d20\u4fdd\u6301\u4e86\u52a8\u753b\u7ed3\u675f\u4e4b\u540e\u7684\u72b6\u6001\u3002<\/p>\n<p><strong>9. accumulate, additive<\/strong><br \/>\n<code>accumulate<\/code>\u662f\u7d2f\u79ef\u7684\u610f\u601d\u3002\u652f\u6301\u53c2\u6570\u6709\uff1a<code>none<\/code> | <code>sum<\/code>. \u9ed8\u8ba4\u503c\u662f<code>none<\/code>. \u5982\u679c\u503c\u662f<code>sum<\/code>\u8868\u793a\u52a8\u753b\u7ed3\u675f\u65f6\u5019\u7684\u4f4d\u7f6e\u4f5c\u4e3a\u4e0b\u6b21\u52a8\u753b\u7684\u8d77\u59cb\u4f4d\u7f6e\u3002<\/p>\n<p><code>additive<\/code>\u63a7\u5236\u52a8\u753b\u662f\u5426\u9644\u52a0\u3002\u652f\u6301\u53c2\u6570\u6709\uff1a<code>replace<\/code> | <code>sum<\/code>. \u9ed8\u8ba4\u503c\u662f<code>replace<\/code>. \u5982\u679c\u503c\u662f<code>sum<\/code>\u8868\u793a\u52a8\u753b\u7684\u57fa\u7840\u77e5\u8bc6\u4f1a\u9644\u52a0\u5230\u5176\u4ed6\u4f4e\u4f18\u5148\u7ea7\u7684\u52a8\u753b\u4e0a\uff0c<\/p>\n<p>\u4e3e\u4e24\u4e2a\u4f8b\u5b50\uff0c\u4e0b\u9762\u662f\u4f8b\u5b501\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;img ...&gt;\r\n&nbsp;&nbsp; &lt;animateMotion begin=\"0\" dur=\"5s\" path=\"<em>[some path]<\/em>\" <span style=\"color:#cd0000;\">additive=\"sum\"<\/span> fill=\"freeze\" \/&gt;\r\n&nbsp;&nbsp; &lt;animateMotion begin=\"5s\" dur=\"5s\" path=\"<em>[some path]<\/em>\" <span style=\"color:#cd0000;\">additive=\"sum\"<\/span> fill=\"freeze\" \/&gt;\r\n&nbsp;&nbsp; &lt;animateMotion begin=\"10s\" dur=\"5s\" path=\"<em>[some path]<\/em>\" <span style=\"color:#cd0000;\">additive=\"sum\"<\/span> fill=\"freeze\" \/&gt;\r\n&lt;\/img&gt;<\/pre>\n<\/div>\n<p>\u8fd9\u91cc\u8f6e\u5230\u7b2c\u4e8c\u4e2a\u52a8\u753b\u7684\u65f6\u5019\uff0c\u8def\u5f84\u662f\u4ece\u7b2c\u4e00\u4e2a\u52a8\u753b\u8def\u5f84\u7ed3\u675f\u5730\u65b9\u5f00\u59cb\u7684\uff0c\u4e8e\u662f\uff0c3\u4e2a\u52a8\u753b\u5b8c\u7f8e\u65e0\u7f1d\u8fde\u63a5\u8d77\u6765\u4e86\u3002<\/p>\n<p>\u4f8b\u5b502\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>\r\n&lt;animateTransform attributeName=\"transform\" type=\"scale\" from=\"1\" to=\"3\" dur=\"10s\" repeatCount=\"indefinite\" additive=\"sum\"\/&gt;\r\n&lt;animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 30 20\" to=\"360 30 20\" dur=\"10s\" fill=\"freeze\" repeatCount=\"indefinite\" additive=\"sum\"\/&gt;;<\/pre>\n<\/div>\n<p>\u8fd9\u91cc\uff0c\u4e24\u4e2a\u52a8\u753b\u540c\u65f6\u90fd\u662f<code>transform<\/code>\uff0c\u90fd\u8981\u4f7f\u7528\u4e00\u4e2a<code>type<\/code>\u5c5e\u6027\uff0c\u597d\u5728\u8fd9\u4e2a\u4f8b\u5b50<code>additive=\"sum\"<\/code>\u662f\u7d2f\u52a0\u7684\u800c\u4e0d\u662f<code>replace<\/code>\u66ff\u6362\u3002\u4e8e\u662f\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u662f\u5b9e\u73b0\u4e00\u8fb9\u65cb\u8f6c\u4e00\u8fb9\u653e\u5927\u7684\u6548\u679c\uff08\u6ca1\u6709\u6548\u679c\u70b9\u8fd9\u91cc<a class=\"a_link\" href=\"\/study\/201408\/horse-animate-sum.svg\" target=\"_blank\">horse-animate-sum.svg<\/a>\uff09\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/study\/201408\/horse-animate-sum.svg\" width=\"320\" height=\"200\" alt=\"\u65cb\u8f6c\u653e\u5927\u6728\u9a6c\"><\/p>\n<p><strong>10. restart<\/strong><br \/>\n<code>restart<\/code>\u8fd9\u4e2a\u5c5e\u6027\u8bde\u751f\u7684\u80cc\u666f\u5982\u4e0b\uff1a\u5f88\u591a\u52a8\u753b\u5462\uff0c\u5176\u89e6\u53d1\u53ef\u80fd\u4e0e\u4e8b\u4ef6\u76f8\u5173\uff0c\u4f8b\u5982\uff0c\u70b9\u51fb\u67d0\u5706\u5708\uff0c\u9a6c\u513f\u5c31\u8dd1\u3002\u800c\u4e14\uff0c\u4f3c\u4e4e\u6ca1\u70b9\u4e00\u6b21\uff0c\u9a6c\u513f\u5c31\u8dd1\u4e00\u4e0b\u3002\u73b0\u5728\uff0c\u5b58\u5728\u8fd9\u79cd\u60c5\u51b5\uff0c\u5e0c\u671b\u9a6c\u513f\u53ea\u8dd1\u4e00\u6b21\uff0c\u4e4b\u540e\u5728\u70b9\u51fb\u5c31\u6ca1\u6709\u53cd\u5e94\u3002\u8fd9\u79cd\u9700\u6c42\u7684\u51fa\u73b0\u8feb\u4f7f<code>restart<\/code>\u53c2\u6570\u7684\u51fa\u73b0\u3002\u652f\u6301\u7684\u53c2\u6570\u6709\uff1a<code>always<\/code> | <code>whenNotActive<\/code> | <code>never<\/code>. <\/p>\n<p><code>always<\/code>\u662f\u9ed8\u8ba4\u503c\uff0c\u8868\u793a\u603b\u662f\uff0c\u4e5f\u5c31\u662f\u70b9\u4e00\u6b21\u5708\u5708\uff0c\u9a6c\u513f\u8dd1\u4e00\u4e0b\u3002<code>whenNotActive<\/code>\u8868\u793a\u52a8\u753b\u6b63\u5728\u8fdb\u884c\u7684\u65f6\u5019\uff0c\u662f\u4e0d\u80fd\u91cd\u542f\u52a8\u753b\u7684\u3002<code>never<\/code>\u8868\u793a\u52a8\u753b\u662f\u4e00\u6ce2\u6d41\u3002<\/p>\n<p>\u5f88\u597d\u7406\u89e3\u7684\u53c2\u6570\uff0c\u5c31\u4e0d\u4e3e\u4f8b\u4e86\u3002<\/p>\n<p><code>11. min, max<\/code><br \/>\n<code>min\/max<\/code>\u8868\u793a\u52a8\u753b\u6267\u884c\u6700\u77ed\u548c\u6700\u957f\u65f6\u95f4\u3002\u652f\u6301\u53c2\u6570\u4e3a\u65f6\u95f4\u503c\u548c<code>\"media\"<\/code>\uff08\u5a92\u4ecb\u5143\u7d20\u6709\u6548\uff09, <code>max<\/code>\u8fd8\u652f\u6301<code>indefinite<\/code>.<\/p>\n<p><code>12. ...<\/code><br \/>\n\u7b49\u5176\u4ed6\u9057\u6f0f\u53c2\u6570\u3002<\/p>\n<h3>\u56db\u3001\u52a8\u753b\u7684\u6682\u505c\u4e0e\u64ad\u653e(\u8865\u5145\u4e8e2015-10-08)<\/h3>\n<p>\u4eca\u5929\u6709\u540c\u4e8b\u8be2\u95ee\u5982\u4f55\u6682\u505c\u52a8\u753b\u3002\u662f\u9171\u6837\u5b50\u7684\uff0cSVG animation\u4e2d\u662f\u6709\u5185\u7f6e\u7684API\u53ef\u4ee5\u6682\u505c\u548c\u542f\u52a8\u52a8\u753b\u7684\u3002\u8bed\u6cd5\u4e3a\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre><span style=\"color:green;\">\/\/ svg\u6307\u5f53\u524dsvg DOM\u5143\u7d20\r\n\/\/ \u6682\u505c<\/span>\r\nsvg.pauseAnimations();\r\n\r\n<span style=\"color:green;\">\/\/ \u91cd\u542f\u52a8<\/span>\r\nsvg.unpauseAnimations()\r\n<\/pre>\n<\/div>\n<p>\u4f8b\u5982\u4e0b\u9762\u8fd9\u4e2a\u9a6c\u513f\uff0c\u70b9\u51fb\u5c31\u4f1a\u6682\u505c\uff0c\u518d\u70b9\u5c31\u4f1a\u91cd\u65b0\u8fd0\u52a8\u3002<br \/>\n<svg width=\"320\" height=\"320\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" onclick=\"if (this.paused != true) { this.pauseAnimations(); this.paused = true; } else  { this.unpauseAnimations(); this.paused = false; }\">  <g>     <text font-family=\"microsoft yahei\" font-size=\"120\" y=\"160\" x=\"160\">\u9a6c<\/text>    <animateTransform      attributeName=\"transform\"      begin=\"0s\"      dur=\"10s\"      type=\"rotate\"      from=\"0 160 160\"      to=\"360 160 160\"      repeatCount=\"indefinite\"     \/>  <\/g><\/svg><\/p>\n<h3>\u4e94\u3001\u5199\u5728\u6df1\u591c\u7684\u7ed3\u675f\u8bed<\/h3>\n<p>SVG SMIL animation\u52a8\u753b\u76f8\u5173\u8d44\u6599\u5f88\u5c11\uff0c\u5c24\u5176\u5bf9\u5404\u4e2a\u5c5e\u6027\u7684\u89e3\u91ca\u3001\u793a\u4f8b\u5185\u5bb9\u51e0\u4e4e\u6ca1\u6709\u3002\u6240\u4ee5\u5462\uff0c\u672c\u6587\u4e00\u4e0d\u5c0f\u5fc3\u5c31\u641e\u5927\u641e\u957f\u4e86\u3002SVG SMIL animation\u52a8\u753b\u4e0d\u9700\u8981JS\u4e5f\u4e0d\u9700\u8981\u638c\u63e1CSS, \u8fd9\u5bf9\u4e8e\u90a3\u4e9b\u559c\u6b22\u52a8\u753b\uff0c\u5bf9\u52a8\u753b\u6709\u60f3\u6cd5\u6709\u5929\u8d4b\u7684\u7684\u8bbe\u8ba1\u5e08\u800c\u8a00\uff0c\u662f\u4e2a\u5f88\u597d\u7684\u5de5\u5177\u3001\u6216\u8005\u8bf4\u821e\u53f0\u3002\u5176\u6709\u673a\u4f1a\u53ef\u4ee5\u597d\u597d\u521b\u9020\u5f88\u591a\u7cbe\u5f69\u7684\u5185\u5bb9\u4e86\uff01\u6211\u5c31\u662f\u8fd9\u4e48\u89c9\u5f97\u7684\u3002<\/p>\n<p>\u597d\uff0c\u5c31\u8fd9\u4e9b\uff0c\u5e0c\u671b\u672c\u6587\u7684\u5185\u5bb9\u80fd\u591f\u5bf9\u611f\u5174\u8da3\u7684\u540c\u884c\u63d0\u4f9b\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\u3002<\/p>\n<p>\u672c\u6587\u524d\u534a\u90e8\u5206\u7684\u6f14\u793a\u5185\u5bb9\u7ec4\u7ec7\u53c2\u8003\uff1a<a href=\"http:\/\/tutorials.jenkov.com\/svg\/svg-animation.html\">SVG Animation<\/a><br \/>\n\u672c\u6587\u540e\u534a\u90e8\u5206\u7684\u53c2\u6570\u6f14\u793a\u8be6\u89e3\u53c2\u8003\uff1a<a href=\"http:\/\/www.w3.org\/TR\/2001\/REC-smil-animation-20010904\/\">SMIL Animation<\/a><\/p>\n<p>\u6b22\u8fce\u8bc4\u8bba\uff0c\u6b22\u8fce\u4ea4\u6d41\uff01<\/p>\n<p><del datetime=\"2019-01-19T09:34:30+00:00\" style=\"color:#ccc;\"><strong>\u66f4\u65b0\u4e8e2017-02-24<\/strong><br \/>\n\u6839\u636e\u6709\u4e9b\u8d44\u6599\u663e\u793a\uff0cChrome 45 &#038; Opera 32\u7248\u672c\u4e4b\u540e SMIL\u4f1a\u5728\u63a7\u5236\u53f0console\u4f1a\u6709\u8b66\u544a\uff08\u867d\u7136\u672c\u4eba\u6ca1\u6709\u770b\u5230\uff09\uff0c\u4ee5\u540e\u6709\u53ef\u80fd\u4e0d\u652f\u6301\u7684\u98ce\u9669\u3002\u6211\u89c9\u5f97\u5e94\u8be5\u662f\u6253\u7b97\u9760CSS\u6765\u6491\u573a\u5b50\uff0c\u56e0\u4e3a\u5f88\u5de7\u7684\u662f\uff0cChrome 46\u548cOpera 33\u6b63\u597d\u5f00\u59cb\u652f\u6301CSS Motion Path\u4e86\uff0c\u771f\u662f\u5fc3\u673a\u6d4f\u89c8\u5668\u3002<\/del><\/p>\n<p><strong>\u66f4\u65b0\u4e8e2019-01-19<\/strong><br \/>\n\u6839\u636e\u7528\u6237\u53cd\u9988\uff0cChrome\u76ee\u524d\u5df2\u7ecf\u6682\u505c\u5e9f\u5f03SMIL\uff0c\u6240\u4ee5\u73b0\u5728\u7684chrome\u5df2\u7ecf\u770b\u4e0d\u5230\u90a3\u53e5warning\u4e86\u3002<\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u65f6\u95f4\u3001\u4eba\u529b\u6210\u672c\u60ca\u4eba\uff0c\u76ee\u524d\u5176\u4ed6\u5730\u65b9\u51e0\u4e4e\u6ca1\u6709\u76f8\u5173\u8d44\u6599\uff01\u56e0\u6b64\u82e5\u8981\u8f6c\u8f7d\uff0c\u9664\u4e86\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u8fd8\u9700\u8981<strong>\u628a\u4e0b\u56fe\u7684\u4e8c\u7ef4\u7801\u56fe\u5f04\u4e0a<\/strong>\uff1b\u6216\u8005\u4efb\u610f\u91d1\u989d\u7684\u53cb\u60c5\u8d44\u52a9\uff0c\u7b97\u662f\u6587\u6863\u8d2d\u4e70\uff0c\u4f60\u53ef\u4ee5\u4efb\u610f\u590d\u5236\u4e0e\u4f20\u64ad\uff01<img decoding=\"async\" src=\"http:\/\/mat1.gtimg.com\/www\/mb\/images\/face\/14.gif\" align=\"absmiddle\"><br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=4333\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=4333<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecdSVG SMIL animation\u52a8\u753b\u3002\u524d\u534a\u90e8\u5206\u4e3b\u8981\u662f\u6548\u679c\u4f53\u9a8c\uff0c\u540e\u534a\u90e8\u5206\u53ea\u8981\u662f\u53c2\u6570\u793a\u610f\u3002\u4e00\u5b9a\u662f\u76ee\u524d\u56fd\u5185\u6700\u8be6\u5c3d\u8bb2\u89e3SVG SMIL animation\u52a8\u753b\u7684\u6587\u7ae0\uff0c\u6ca1\u6709\u4e4b\u4e00\u3002\u5185\u5bb9\u624e\u5b9e\uff0c\u4e30\u5bcc\u7684\u6548\u679c\u5c55\u793a\uff0c\u5927\u91cf\u7684\u6e90\u7801\u793a\u610f\u3002\u76f8\u4fe1\u4e00\u5b9a\u4f1a\u5bf9\u60a8\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\u7684\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[895],"tags":[531,944,642,287,204,919],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/4333"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=4333"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/4333\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=4333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=4333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=4333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}