{"id":1701,"date":"2023-03-21T15:09:48","date_gmt":"2023-03-21T07:09:48","guid":{"rendered":"https:\/\/www.wurend.com\/?p=1701"},"modified":"2024-08-13T21:29:13","modified_gmt":"2024-08-13T13:29:13","slug":"%e3%80%90ae%e8%a1%a8%e8%be%be%e5%bc%8f%e3%80%91%e4%b8%87%e8%83%bd%e5%bc%b9%e6%80%a7%e8%a1%a8%e8%be%be%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.wurend.com\/?p=1701","title":{"rendered":"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<div class=\"wp-block-pandastudio-title\"><div class=\"title_style_01\"><p>\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f<\/p><\/div><\/div>\n\n\n\n<p><\/p>\n\n\n<p>freq = 6;<br \/>\ndecay = 4;<br \/>\nn = 0;<\/p>\n<p>if (numKeys &gt; 0){<\/p>\n<p>  n = nearestKey(time).index;<\/p>\n<p>\tif (key(n).time &gt; time){<br \/>\n\t\tn&#8211;;<br \/>\n\t}<br \/>\n}<\/p>\n<p>if (n &gt; 0){<br \/>\n\tt = time &#8211; key(n).time;<br \/>\n\tamp = velocityAtTime(key(n).time &#8211; .001);<br \/>\n\tw = freq*Math.PI*2;<br \/>\n\tvalue + amp*(Math.sin(t*w)\/Math.exp(decay*t)\/w);<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\tvalue<br \/>\n}<\/p>\n\n\n\n<p>\u9762\u5f00\u59cb\u89e3\u91ca\uff0c\u524d\u4e09\u884c\u5c31\u4e0d\u7528\u8bf4\u4e86\uff0c\u90fd\u662f\u53d8\u91cf\u7684\u5b9a\u4e49\uff0c\u5206\u522b\u662f\u632f\u5e45\u3001\u9891\u7387\u3001\u8870\u53d8\u6307\u6570\u6216\u8005\u53eb\u963b\u529b\u963b\u5c3c\u5565\u7684<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">n=0;<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">N\u5176\u5b9e\u662f\u7528\u6765\u8bb0\u5f55\u5173\u952e\u5e27\u5e8f\u53f7\u7684\uff0c\u8fd9\u4e2a\u53d8\u91cf\u5f88\u91cd\u8981<\/p>\n\n\n\n<p>if (numKeys &gt; 0)<\/p>\n\n\n\n<p>\u5224\u65ad\u5173\u952e\u5e27\u4e2a\u6570\u662f\u5426\u5927\u4e8e0,\u5982\u679c\u662f\u6267\u884c{}\u4e2d\u5185\u5bb9<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">n = nearestKey(time).index<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">\u53d6\u9760\u8fd1\u65f6\u95f4\u7ebf\u7684\u90a3\u4e2a\u5173\u952e\u5e27\u7684\u5e8f\u53f7\uff0c\u8fd9\u91cc\u8981\u6ce8\u610f\u53d6\u5f97\u7684\u5173\u952e\u5e27\u6709\u53ef\u80fd\u662f\u65f6\u95f4\u7ebf\u524d\u7684\u6700\u540e\u4e00\u4e2a\uff0c\u4e5f\u53ef\u80fd\u662f\u65f6\u95f4\u7ebf\u540e\u7684\u7b2c\u4e00\u4e2a\uff0c\u6240\u4ee5\u624d\u6709\u4e0b\u4e00\u53e5\u7684IF\u5224\u65ad\u3002<\/p>\n\n\n\n<p>if (key(n).time &gt; time){n&#8211;;}<\/p>\n\n\n\n<p>\u5982\u679c\u53d6\u5f97\u7684\u5173\u952e\u5e27\u662f\u65f6\u95f4\u7ebf\u540e\u9762\u7b2c\u4e00\u4e2a\uff0c\u5219N\u7684\u5e8f\u53f7\u51cf1\uff0c\u8fd9\u6837\u5c31\u4fdd\u8bc1\u91ccN\u6c38\u8fdc\u4ee3\u8868\u7684\u662f\u65f6\u95f4\u7ebf\u524d\u7684\u6700\u540e\u4e00\u4e2a\u5173\u952e\u5e27\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">if (n == 0){ t = 0;}<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">\u5982\u679c\u6ca1\u6709\u5173\u952e\u5e27\uff08N=0\uff09\u65f6\uff0cT=0\u3002T\u662f\u4e00\u4e2a\u9891\u7387\u6539\u53d8\u56e0\u6570\uff0c\u4e5f\u662f\u4e00\u4e2a\u963b\u529b\u6539\u53d8\u7684\u56e0\u6570\u3002<\/p>\n\n\n\n<p>else{t = time &#8211; key(n).time;}<\/p>\n\n\n\n<p>\u5982\u679cN\u4e0d\u4e3a0\uff0c\u90a3\u4e48T\u5c31\u7b49\u4e8e\u65f6\u95f4\u7ebf\u4e0e\u5176\u4e4b\u524d\u6700\u540e\u4e00\u4e2a\u5173\u952e\u5e27\u7684\u65f6\u95f4\u7684\u5dee\uff0c\u4e5f\u5c31\u662f\u8bf4\u65f6\u95f4\u7ebf\u79bb\u8fd9\u4e2a\u5173\u952e\u5e27\u8d8a\u8fdcT\u5c31\u8d8a\u5927\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">if (n &gt; 0)<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">\u5f53\u6709\u5173\u952e\u5e27\uff0c\u4e5f\u5c31\u662f\u8bf4\u6709\u52a8\u753b\u7684\u65f6\u5019\u6267\u884c{}\u91cc\u7684\u5185\u5bb9\uff0c\u524d\u9762\u90a3\u4e9b\u53e5\u90fd\u662f\u94fa\u57ab\uff0c\u8fd9\u4e2a\u5927\u62ec\u53f7\u91cc\u7684\u624d\u662f\u6b63\u620f\u3002<\/p>\n\n\n\n<p>v = velocityAtTime(key(n).time &#8211; thisComp.frameDuration\/10);<\/p>\n\n\n\n<p>velocityAtTime()\u8fd9\u4e2a\u51fd\u6570\u662f\u6c42\u5728\u67d0\u4e00\u65f6\u523b\u5bf9\u8c61\u7684\u901f\u5ea6\uff0cAE\u91cc\u9762\u53eb\u5173\u952e\u5e27\u6570\u7387\uff0c\u5355\u4f4d\u662f\u201c\u50cf\u7d20\/\u79d2\u201d\uff0c\u600e\u4e48\u7406\u89e3\u8fd9\u4e2a\u5462\uff1f\u5176\u5b9e\u5c31\u662f\u4f60\u5728\u505a\u5bf9\u8c61\u4f4d\u79fb\u52a8\u753b\u65f6\uff0c\u5173\u952e\u5e27\u65f6\u523b\u5bf9\u8c61\u76f8\u5bf9\u5c4f\u5e55<\/p>\n\n\n\n<p>\u7684\u77ac\u65f6\u901f\u5ea6\uff0c\u8bf4\u5c4f\u5e55\u6709\u70b9\u4e0d\u51c6\u786e\uff0c\u5e94\u8be5\u8bf4\u5bf9\u8c61\u6240\u5728\u5408\u6210\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">thisComp.frameDuration \u7684\u89e3\u91ca\u662f\u201c\u8fd4\u56de\u753b\u9762\u7684\u6301\u7eed\u65f6\u95f4\u201d<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">thisComp.frameDuration\/10 \u8fd9\u4e2a\u662f\u4e0d\u80fd\u53bb\u6389\u7684\uff0c\u4e0d\u7136\u4f1a\u51fa\u73b0\u5f88\u5947\u602a\u7684\u5f39\u52a8\u73b0\u8c61\u3002\u4f46\u662f\u51cf\u53f7\u540e\u9762\u4e5f\u4e0d\u4e00\u5b9a\u8981\u662f thisComp.frameDuration\/10 \uff0c\u53ea\u8981\u662f\u4e00\u4e2a\u975e\u5e38\u5c0f\u7684\u6570\u5c31\u53ef\u4ee5\uff0c\u4e3b\u8981\u53ef\u80fd\u662f\u53d6\u5173\u952e\u5e27\u524d\u5f88\u77ed\u4e00\u4e2a\u65f6\u523b\u7684\u901f\u5ea6\uff0c\u5c31\u7b97\u662f\u7528F9\u5e73\u6ed1\u5173\u952e\u5e27\uff0c\u5f39\u52a8\u4e5f\u80fd\u53d1\u751f\u6548\u679c\u3002\u7528 thisComp.frameDuration\/10 \u53ea\u662f\u56e0\u4e3a\u5b83\u8db3\u591f\u5c0f\uff0c\u56e0\u4e3a\u662f\u5e27\u7387\u65f6\u95f4\u76841\/10.<\/p>\n\n\n\n<p>value + v*amp*Math.sin(freq*t*2*Math.PI)\/Math.exp(decay*t);<\/p>\n\n\n\n<p>\u8089\u90fd\u5728\u8fd9\u53e5\u4e86\uff0c\u5475\u5475\uff01<\/p>\n\n\n\n<p>value+&nbsp;\u8fd9\u4e2a\u662f\u5728\u539f\u6765\u503c\u7684\u57fa\u7840\u4e0a\u505a\u5f39\u6027\u8bbe\u7f6e\u7684\uff0c\u8fd9\u4e48\u5199\u7684\u597d\u5904\u662f\u65e0\u8bba\u4f60\u628a\u8fd9\u6bb5\u8868\u8fbe\u5f0f\u653e\u57282D\u8fd8\u662f3D\u56fe\u5c42\u4e2d\u90fd\u53ef\u4ee5\u8d77\u4f5c\u7528\uff0c\u4e0d\u7528[x,y,z]\u8fd9\u4e48\u5199\u662f\u786e\u4fdd\u52a8\u753b\u5728\u4e09\u4e2a\u8f74\u5411\u4e0a\u7684\u8fd0\u52a8\u90fd\u4f1a<\/p>\n\n\n\n<p>\u6709\u5f39\u6027\u52a8\u753b\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\"><strong>value + amp<em>(Math.sin(t<\/em>w)\/Math.exp(decay*t)\/w);<\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">V\u662f\u5bf9\u8c61\u5173\u952e\u5e27\u7684\u77ac\u65f6\u901f\u5ea6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u662f\u4f5c\u4e3a\u4e00\u4e2a\u632f\u5e45\u53d8\u91cf\u7684\u8865\u5145\uff0c\u8fd9\u6837\u66f4\u7b26\u5408\u7269\u7406\u73b0\u8c61\uff0c\u5f53\u901f\u5ea6\u8d8a\u5927\u632f\u5e45\u5c31\u8d8a\u5927\u3002\u5f53\u5bf9\u8c61\u7684\u901f\u5ea6\u662f0\u65f6\uff0c\u90a3\u5f39\u6027\u8868\u8fbe\u5f0f\u7ed3\u679c\u4e5f\u4e3a0\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">T\u5728Math.sin()\u4e2d\u662f\u4f5c\u4e3a\u9891\u7387\u7684\u8865\u5145\uff0c\u4f5c\u7528\u662f\u65f6\u95f4\u7ebf\u79bb\u5173\u952e\u5e27\u8d8a\u8fdc\uff0c\u503c\u8d8a\u5927\u9891\u7387\u8d8a\u5feb\uff0c\u8fd9\u6837\u6bd4\u8f83\u7b26\u5408\u7269\u7406\u89c4\u5f8b\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">T\u5728Math.exp()\u4e2d\u8bd5\u963b\u529b\u6307\u6570\uff0c\u4f5c\u7528\u662f\u65f6\u95f4\u7ebf\u79bb\u5173\u952e\u5e27\u8d8a\u8fdc\uff0c\u503c\u8d8a\u5927\u963b\u529b\u8d8a\u5927\uff0c\u6700\u540e\u8ba9\u5f39\u52a8\u5f52\u4e8e\u5e73\u9759\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">\u5982\u679c\u4f60\u89c9\u5f97\u6548\u679c\u4e0d\u5177\u6709\u51b2\u51fb\u529b\u53ef\u4ee5\u5728  \uff1b\u524d*n   \u5176\u4e2dn\u4e3a\u4efb\u610f\u5e38\u6570<\/p>\n\n\n\n<p>else{value}<\/p>\n\n\n\n<p>\u5982\u679c\u6ca1\u6709\u5173\u952e\u5e27\uff0c\u539f\u6765\u503c\u4fdd\u6301\u4e0d\u53d8\u3002<\/p>\n\n\n\n<p>\u8865\u5145\u4e00\u4e0b\uff1a\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u5728\u5173\u952e\u5e27\u505a\u5e73\u6ed1\u4ee5\u540e\u662f\u4e0d\u8d77\u4f5c\u7528\u7684\uff0c\u56e0\u4e3a\u5e73\u6ed1\u540e\u7684\u5173\u952e\u5e27\u901f\u5ea6\u662f0\u3002\u518d\u4e00\u4e2a\u5c31\u662f\u5982\u679c\u6709\u4e24\u4e2a\u4ee5\u4e0a\u5173\u952e\u5e27\u7684\u65f6\u5019\uff0c\u9664\u7b2c\u4e00\u4e2a\u5916\u90fd\u4f1a\u6709\u5f39\u6027\u6548\u679c\uff0c\u7a0b\u5e8f\u672a\u505a\u5224\u65ad\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658198894877639.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\"><img decoding=\"async\" src=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658198894877639.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658198974841665.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\"><img decoding=\"async\" src=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658198974841665.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658198974339924.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\"><img decoding=\"async\" src=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658198974339924.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658199005903622.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\"><img decoding=\"async\" src=\"https:\/\/www.wurend.com\/wp-content\/uploads\/2023\/03\/202207191658199005903622.gif\" alt=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" title=\"\u3010AE\u8868\u8fbe\u5f0f\u3011\u4e07\u80fd\u5f39\u6027\u8868\u8fbe\u5f0f\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u9762\u5f00\u59cb\u89e3\u91ca\uff0c\u524d\u4e09\u884c\u5c31\u4e0d\u7528\u8bf4\u4e86\uff0c\u90fd\u662f\u53d8\u91cf\u7684\u5b9a\u4e49\uff0c\u5206\u522b\u662f\u632f\u5e45\u3001\u9891\u7387\u3001\u8870\u53d8\u6307\u6570\u6216\u8005\u53eb\u963b\u529b\u963b\u5c3c\u5565\u7684 n=0; N\u5176\u5b9e\u662f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1706,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110,17,39,109],"tags":[113,111,112],"class_list":{"0":"post-1701","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-ae","8":"category-17","9":"category-39","10":"category-109","11":"tag-ae","13":"tag-112"},"_links":{"self":[{"href":"https:\/\/www.wurend.com\/index.php?rest_route=\/wp\/v2\/posts\/1701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wurend.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wurend.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wurend.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wurend.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1701"}],"version-history":[{"count":1,"href":"https:\/\/www.wurend.com\/index.php?rest_route=\/wp\/v2\/posts\/1701\/revisions"}],"predecessor-version":[{"id":1739,"href":"https:\/\/www.wurend.com\/index.php?rest_route=\/wp\/v2\/posts\/1701\/revisions\/1739"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wurend.com\/index.php?rest_route=\/wp\/v2\/media\/1706"}],"wp:attachment":[{"href":"https:\/\/www.wurend.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wurend.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wurend.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}