{"id":1404,"date":"2019-09-27T23:06:23","date_gmt":"2019-09-27T15:06:23","guid":{"rendered":"https:\/\/www.develop-note.com\/blog\/?p=1404"},"modified":"2022-02-17T15:03:50","modified_gmt":"2022-02-17T07:03:50","slug":"2020ironman-svelte-draw","status":"publish","type":"post","link":"https:\/\/www.develop-note.com\/blog\/2019\/09\/27\/2020ironman-svelte-draw\/","title":{"rendered":"\u7b2c\u5341\u4e00\u5c46\u9435\u4eba\u8cfd \u524d\u7aef\u5de5\u7a0b\u5e2b\u7684\u53e6\u4e00\u500b\u9078\u64c7 svelte DAY26- \u904e\u5834\u52d5\u756b (\u4e09)"},"content":{"rendered":"<h1>draw<\/h1>\n<p>\u5728\u6628\u5929\u8ddf\u5927\u5bb6\u5206\u4eab<a href=\"https:\/\/www.develop-note.com\/blog\/2019\/09\/26\/2020ironman-svelte-slide-scale\/\" title=\"slider scale\">slider scale<\/a>\u9019\u5169\u500b\u904e\u5834\u52d5\u756b\uff0c\u63a5\u4e0b\u4f86\u4eca\u5929\u4ecb\u7d39\u6bd4\u4e0d\u4e00\u6a23\u7684\u5167\u5bb9\uff0c\u5c31\u662f\u900f\u904e\u756b\u51fasvg\u4f86\u5448\u73fe\u904e\u5834\u52d5\u756b\u3002<!--more--><\/p>\n<h2>draw \u662f\u751a\u9ebc<\/h2>\n<p>\u5c31\u5982\u540c\u5b57\u9762\u610f\u601d<code>draw<\/code>\u5c31\u662f\u7e6a\u5716\u7684\u610f\u601d\uff0c\u5728svelte\u6307\u7684\u662f\u5728svg\u4e0a\u9762\u4f5c\u756b\uff0c\u81f3\u65bcsvg\u600e\u9ebc\u8a71\u53ef\u4ee5\u770b\u4e00\u4e0b<a href=\"https:\/\/www.w3schools.com\/graphics\/svg_intro.asp\" title=\"W3Schools SVG\" rel=\"nofollow noopener\" target=\"_blank\">W3Schools SVG<\/a>\uff0c\u9019\u88e1\u9762\u6709\u5f88\u591asvg\u76f8\u95dc\u7684\u77e5\u8b58\u3002<\/p>\n<h2>draw \u600e\u9ebc\u7528<\/h2>\n<p>\u9019\u6642\u53c8\u8981\u8907\u7fd2\u4e00\u4e0b\u95dc\u65bc svelte \u7684\u904e\u5834\u52d5\u756b\u7684\u57fa\u672c\u77e5\u8b58\u4e86\uff0c\u7c21\u55ae\u8b1b\u5c31\u662f\u4e0b\u5217\u4e09\u500b\u6b65\u9a5f\u3002<\/p>\n<ul>\n<li>import svelte\/transition<\/li>\n<li>\u8a2d\u5b9a\u689d\u4ef6<\/li>\n<li>\u8a2d\u5b9a\u689d\u4ef6\u6210\u7acb\u662f\u8981\u51fa\u73fe\u7684\u904e\u5834\u52d5\u756b<\/li>\n<\/ul>\n<p>\u7c21\u55ae\u7528\u4f8b\u5b50\u4f86\u5448\u73fe\u5982\u4e0b\u5217\u7a0b\u5f0f\u78bc\u3002<\/p>\n<pre><code class=\"language-xml\">&lt;script&gt;\n    import { draw } from &#039;svelte\/transition&#039;;\n    import { quintOut } from &#039;svelte\/easing&#039;;\n    let isVisable = true;\n&lt;\/script&gt;\n&lt;input type=&quot;checkbox&quot; bind:checked={isVisable} \/&gt;\n&lt;svg viewBox=&quot;0 0 5 5&quot; xmlns=&quot;http:\/\/www.w3.org\/2000\/svg&quot;&gt;\n\n    {#if isVisable}\n        &lt;path transition:draw=&quot;{{duration: 5000, delay: 500, easing: quintOut}}&quot;\n                    d=&quot;M2 1 h1 v1 h1 v1 h-1 v1 h-1 v-1 h-1 v-1 h1 z&quot;\n                    fill=&quot;none&quot;\n                    stroke=&quot;cornflowerblue&quot;\n                    stroke-width=&quot;0.1px&quot;\n                    stroke-linejoin=&quot;round&quot;\n        \/&gt;\n      &lt;polyline transition:draw=&quot;{{duration: 5000, delay: 500, easing: quintOut}}&quot; points=&quot;1,1 1.5,1.5 1.8,2.0 2.2,3.0 3.1,4.5 1.5,4.5&quot;\n  style=&quot;fill:none;stroke:black;stroke-width:0.1px&quot; \/&gt;\n    {\/if}\n&lt;\/svg&gt;<\/code><\/pre>\n<p>\u9019\u908a\u8aaa\u660e\u4e00\u4e0b\uff0c\u56e0\u70ba\u662f\u7e6a\u5716\u6240\u4ee5\u9019\u88e1\u80fd\u5920\u7528\u7684\u662f<code>path<\/code>\u8ddf<code>polyline<\/code>\uff0c\u7136\u5f8c\u53ef\u4ee5\u53c3\u8003<a href=\"https:\/\/www.w3schools.com\/graphics\/svg_intro.asp\" title=\"W3Schools SVG\" rel=\"nofollow noopener\" target=\"_blank\">W3Schools SVG<\/a>\u4f86\u64cd\u4f5csvg\u7684<code>path<\/code>\u8ddf<code>polyline<\/code>\uff0c\u63a5\u4e0b\u4f86\u4f7f\u7528<code>transition:draw<\/code>\u9019\u500bsvelte\u5c6c\u6027\uff0c\u6700\u5f8c\u7d66\u4e88\u63a7\u5236<code>draw<\/code>\u7684\u53c3\u6578\uff0c<code>duration<\/code>\u7e6a\u756b\u7684\u671f\u9593\u591a\u5c11\u6beb\u79d2\uff0c<code>delay<\/code>\u5ef6\u9072\u591a\u5c11\u6beb\u79d2\uff0c<code>easing<\/code>\u662f\u6d88\u5931\u7684\u52d5\u756b\u600e\u9ebc\u5448\u73fe\u3002<\/p>\n<h2>\u5c0f\u7d50<\/h2>\n<p>\u4eca\u5929\u8ddf\u5927\u5bb6\u5206\u4eab<code>draw<\/code>\u904e\u5834\u52d5\u756b\u7684\u7528\u6cd5\uff0c\u9019\u90e8\u5206\u9084\u6709\u5f88\u591a\u6c92\u6709\u8aaa\u660e\u7684\u4f8b\u5982<code>easing<\/code>\u52d5\u756b\uff0c\u5f85\u5f8c\u7e8c\u6709\u6a5f\u6703\u518d\u8ddf\u5927\u5bb6\u4ecb\u7d39\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>draw \u5728\u6628\u5929\u8ddf\u5927\u5bb6\u5206\u4eabslider scale\u9019\u5169\u500b\u904e\u5834\u52d5\u756b\uff0c\u63a5\u4e0b\u4f86\u4eca\u5929\u4ecb\u7d39\u6bd4\u4e0d\u4e00\u6a23\u7684\u5167\u5bb9\uff0c\u5c31\u662f\u900f\u904e\u756b\u51fas &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.develop-note.com\/blog\/2019\/09\/27\/2020ironman-svelte-draw\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u7b2c\u5341\u4e00\u5c46\u9435\u4eba\u8cfd \u524d\u7aef\u5de5\u7a0b\u5e2b\u7684\u53e6\u4e00\u500b\u9078\u64c7 svelte DAY26- \u904e\u5834\u52d5\u756b (\u4e09)\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[160,79],"class_list":["post-1404","post","type-post","status-publish","format-standard","hentry","category-develop","tag-2019ironman","tag-svelte"],"_links":{"self":[{"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/posts\/1404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/comments?post=1404"}],"version-history":[{"count":7,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/posts\/1404\/revisions"}],"predecessor-version":[{"id":2999,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/posts\/1404\/revisions\/2999"}],"wp:attachment":[{"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/media?parent=1404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/categories?post=1404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/tags?post=1404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}