{"id":1372,"date":"2019-09-23T00:05:10","date_gmt":"2019-09-22T16:05:10","guid":{"rendered":"https:\/\/www.develop-note.com\/blog\/?p=1372"},"modified":"2022-02-17T14:58:08","modified_gmt":"2022-02-17T06:58:08","slug":"2020ironman-svelte-motion-tweened","status":"publish","type":"post","link":"https:\/\/www.develop-note.com\/blog\/2019\/09\/23\/2020ironman-svelte-motion-tweened\/","title":{"rendered":"\u7b2c\u5341\u4e00\u5c46\u9435\u4eba\u8cfd \u524d\u7aef\u5de5\u7a0b\u5e2b\u7684\u53e6\u4e00\u500b\u9078\u64c7 svelte DAY21- \u52d5\u614b tweened"},"content":{"rendered":"<h1>Motion Tweened<\/h1>\n<p>Motion Tweened \u662f\u4eca\u5929\u8981\u5206\u4eab\u7684\u5167\u5bb9\uff0c\u5728\u5206\u4eab\u5b8cstore\u4e4b\u5f8c\u53e6\u4e00\u500b\u9032\u968e\u7684 svelte\u7684\u5167\u5bb9\u5c31\u662f motion\uff0c\u800c\u7b2c\u4e00\u500b\u8981\u5206\u4eab\u7d66\u5927\u5bb6\u7684motionn\u5c31\u662f\u4eca\u5929\u8981\u5206\u4eab\u7684tweened\u3002<!--more--><\/p>\n<h2>Tweened \u662f\u751a\u9ebc<\/h2>\n<p>\u6240\u8b02\u7684 Tweened \u628a\u52d5\u614b\u4e4b\u9593\u7684\u90e8\u5206\u7528\u5167\u63d2\u6cd5\u628a\u52d5\u614b\u88dc\u9f4a\uff0c\u7c21\u55ae\u8b1b\u5c31\u662f\u770b\u8d77\u52d5\u614b\u4e0d\u6703\u6709\u8df3\u683c\u7684\u73fe\u8c61\uff0c\u6240\u4ee5\u5728\u5be6\u4f5c Tweened \u4e4b\u524d\u5148\u4f86\u505a\u4e00\u500b\u4e0d\u662f\u7528 Tweened \u7684 Progress Bar\uff0c\u8acb\u770b\u4ee5\u4e0b\u5167\u5bb9\u3002<\/p>\n<pre><code class=\"language-xml\">&lt;script&gt;\n    import { writable } from &#039;svelte\/store&#039;;\n\n    const progress = writable(0);\n&lt;\/script&gt;\n\n&lt;style&gt;\n    progress {\n        display: block;\n        width: 100%;\n    }\n&lt;\/style&gt;\n\n&lt;progress value={$progress}&gt;&lt;\/progress&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0)}&quot;&gt;\n    0%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0.25)}&quot;&gt;\n    25%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0.5)}&quot;&gt;\n    50%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0.75)}&quot;&gt;\n    75%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(1)}&quot;&gt;\n    100%\n&lt;\/button&gt;<\/code><\/pre>\n<p>\u9019\u662f\u4e00\u500b\u5f88\u7c21\u55ae\u7684Progress Bar\u7684\u4f8b\u5b50\uff0c\u7576\u904b\u4f5c\u8d77\u4f86\u8b80\u8005\u53ef\u4ee5\u770b\u5230\u76f4\u63a5\u9ede\u53ca\u6309\u9215\u6240\u9020\u6210\u7684\u7d50\u679c\u5c31\u662f\u76f4\u63a5\u8dd1\u5230\u6307\u5b9a\u7684\u9032\u5ea6\uff0c\u63a5\u4e0b\u4f86\u6211\u5011\u5c07\u8981\u5be6\u4f5cTweened\u7248\u672c\u7684 Progress Bar\u3002<\/p>\n<h2>\u5be6\u4f5c Tweened \u7248\u672c\u7684 Progress Bar<\/h2>\n<p>\u5be6\u4f5c\u5176\u5be6\u5f88\u7c21\u55ae\uff0c\u5927\u5bb6\u53ef\u4ee5\u5148\u770b\u4e00\u4e0b\u4e0b\u9762\u7684\u7a0b\u5f0f\u78bc\u3002<\/p>\n<pre><code class=\"language-html\">&lt;script&gt;\n    import { tweened } from &#039;svelte\/motion&#039;;\n\n    const progress = tweened(0);\n&lt;\/script&gt;\n\n&lt;style&gt;\n    progress {\n        display: block;\n        width: 100%;\n    }\n&lt;\/style&gt;\n\n&lt;progress value={$progress}&gt;&lt;\/progress&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0)}&quot;&gt;\n    0%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0.25)}&quot;&gt;\n    25%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0.5)}&quot;&gt;\n    50%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(0.75)}&quot;&gt;\n    75%\n&lt;\/button&gt;\n\n&lt;button on:click=&quot;{() =&gt; progress.set(1)}&quot;&gt;\n    100%\n&lt;\/button&gt;<\/code><\/pre>\n<p>\u5176\u5be6\u7c21\u55ae\u8b1b\u4e5f\u6c92\u6709\u4fee\u6539\u751a\u9ebc\uff0c\u5c31\u662f\u628a\u4e4b\u524d\u7684writable\u7528tweened\u7d66\u53d6\u4ee3\u6389\u800c\u5df2\uff0c\u9019\u908a\u8981\u6ce8\u610f\u7684\u662f\u4f7f\u7528tweened\u8981\u5148\u91cdsvelte\/motion\u5167import tweened\u9032\u4f86\u3002<\/p>\n<h2>\u5c0f\u7d50<\/h2>\n<p>\u4eca\u5929\u7684\u5167\u5bb9\u5f88\u7c21\u55ae\uff0c\u5c31\u662f\u900f\u904eimport svelte\/motion\u4e2d\u7684tweened\u5c31\u53ef\u4ee5\u5b8c\u6210\u4e00\u500b\u52d5\u614b\u5167\u5dee\u7684 Progress Bar\uff0c\u6240\u4ee5\u8aaa svelte\u662f\u4e0d\u662f\u5f88\u65b9\u4fbf\u5462\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Motion Tweened Motion Tweened \u662f\u4eca\u5929\u8981\u5206\u4eab\u7684\u5167\u5bb9\uff0c\u5728\u5206\u4eab\u5b8cstore\u4e4b\u5f8c\u53e6\u4e00\u500b\u9032 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.develop-note.com\/blog\/2019\/09\/23\/2020ironman-svelte-motion-tweened\/\" 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 DAY21- \u52d5\u614b tweened\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-1372","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\/1372","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=1372"}],"version-history":[{"count":5,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/posts\/1372\/revisions"}],"predecessor-version":[{"id":2993,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/posts\/1372\/revisions\/2993"}],"wp:attachment":[{"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/media?parent=1372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/categories?post=1372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.develop-note.com\/blog\/wp-json\/wp\/v2\/tags?post=1372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}