{"id":10008371,"date":"2024-02-20T16:01:33","date_gmt":"2024-02-20T08:01:33","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008371"},"modified":"2024-02-20T16:01:33","modified_gmt":"2024-02-20T08:01:33","slug":"%e4%b8%80%e8%b5%b7%e6%9d%a5%e4%bd%bf%e7%94%a8node-js%e5%88%b6%e4%bd%9c%e4%b8%80%e4%b8%aa%e8%a7%86%e9%a2%91%e5%90%a7","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008371","title":{"rendered":"\u4e00\u8d77\u6765\u4f7f\u7528node.js\u5236\u4f5c\u4e00\u4e2a\u89c6\u9891\u5427"},"content":{"rendered":"<hr>\n<h2>theme: fancy<\/h2>\n<blockquote>\n<p>TNTWeb &#8211; \u5168\u79f0\u817e\u8baf\u65b0\u95fb\u524d\u7aef\u56e2\u961f\uff0c\u7ec4\u5185\u5c0f\u4f19\u4f34\u5728Web\u524d\u7aef\u3001NodeJS\u5f00\u53d1\u3001UI\u8bbe\u8ba1\u3001\u79fb\u52a8APP\u7b49\u5927\u524d\u7aef\u9886\u57df\u90fd\u6709\u6240\u5b9e\u8df5\u548c\u79ef\u7d2f\u3002<\/p>\n<p>\u76ee\u524d\u56e2\u961f\u4e3b\u8981\u652f\u6301\u817e\u8baf\u65b0\u95fb\u5404\u4e1a\u52a1\u7684\u524d\u7aef\u5f00\u53d1\uff0c\u4e1a\u52a1\u5f00\u53d1\u4e4b\u4f59\u4e5f\u79ef\u7d2f\u6c89\u6dc0\u4e86\u4e00\u4e9b\u524d\u7aef\u57fa\u7840\u8bbe\u65bd\uff0c\u8d4b\u80fd\u4e1a\u52a1\u63d0\u6548\u548c\u4ea7\u54c1\u521b\u65b0\u3002<\/p>\n<p>\u56e2\u961f\u5021\u5bfc\u5f00\u6e90\u5171\u5efa\uff0c\u62e5\u6709\u5404\u79cd\u6280\u672f\u5927\u725b\uff0c\u56e2\u961fGithub\u5730\u5740\uff1a<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=tORGhYcsglCQP0UA8C8tXA%3D%3D.cAK5qEH%2F%2F1qQLDtIIx57vCDTpVBlAeh1IB9Kg2h6Z6w%3D\" rel=\"noopener noreferrer\">https:\/\/github.com\/tnfe<\/a><\/p>\n<p>\u4eca\u5929\u4e3a\u5927\u5bb6\u4ecb\u7ecdFFCreator\uff0c\u9879\u76ee\u5730\u5740: <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=N0dxSF34QVQm1Z3saRHRWA%3D%3D.%2FBCrht1jOrwePIkIdkQr158lN%2FeRnVy5nYL9OFhHbcjY6hjjdUy%2FeHBMDcgwC2up\" rel=\"noopener noreferrer\">FFCreator<\/a><\/p>\n<\/blockquote>\n<h2>(\u524d\u8a00)\u8bf4\u70b9\u4e8b\u60c5<\/h2>\n<p>\u5f53\u524d\u592a\u5e73\u76db\u4e16\uff0c\u53ef\u662f\u4e92\u8054\u7f51\u9886\u57df\u53ef\u7b97\u662f\u4e00\u76f4\u4e71\u4e16\u3002\u4eca\u5929\u6211\u4eec\u6240\u8bf4\u7684\u662f\u77ed\u89c6\u9891\u9886\u57df\u3002<\/p>\n<p>\u77ed\u89c6\u9891\u5df2\u6210\u4e3a\u4e00\u79cd\u8d8a\u6765\u8d8a\u6d41\u884c\u7684\u5a92\u4f53\u4f20\u64ad\u5f62\u5f0f\u3002\u50cf<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=PqdfIUaW0az2qs6ptGWOXA%3D%3D.QEkoQtB%2BI9oOznFvAdxYbvSoC1%2BtU9eKF5aYg85jLwA%3D\" rel=\"noopener noreferrer\">\u5fae\u89c6<\/a>\u548c\u6296\u97f3\u8fd9\u79cd app\uff0c\u6bcf\u5929\u90fd\u4f1a\u751f\u4ea7\u6210\u5343\u4e0a\u4e07\u4e2a\u7cbe\u5f69\u77ed\u89c6\u9891\u3002\u800c\u8fd9\u4e9b\u89c6\u9891\u4e5f\u4e3a\u4ea7\u54c1\u5e26\u6765\u4e86\u5de8\u5927\u7684\u6d41\u91cf\u3002<br \/>\u968f\u4e4b\u800c\u6765\uff0c\u5982\u4f55\u8ba9\u7528\u6237\u53ef\u4ee5\u5feb\u901f\u751f\u4ea7\u4e00\u4e2a\u77ed\u89c6\u9891\uff1b\u6216\u8005\u4ea7\u54c1\u5e73\u53f0\u5982\u4f55\u5229\u7528\u5df2\u6709\u7684\u56fe\u7247\u3001\u89c6\u9891\u3001\u97f3\u4e50\u7d20\u6750\u6279\u91cf\u5408\u6210\u5927\u91cf\u89c6\u9891\u5c31\u6210\u4e3a\u4e00\u4e2a\u6280\u672f\u96be\u70b9\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044641704\" alt=\"01.jpg\" title=\"01.jpg\"><\/p>\n<p>\u4eca\u5929\u4e3a\u5927\u5bb6\u5e26\u6765\u7684\u662f\u4e00\u4e2a\u57fa\u4e8e<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=1fn2fWy3s286szW%2FZXEL7g%3D%3D.6OrzKLnHqys7sUx%2B7S3WMzFzdmwO%2Fm%2BLN12hceKbzYU%3D\" rel=\"noopener noreferrer\">node.js<\/a>\u7684\u8f7b\u91cf\u3001\u7075\u6d3b\u7684\u77ed\u89c6\u9891\u5236\u4f5c\u5e93\u3002\u60a8\u53ea\u9700\u8981\u6dfb\u52a0\u51e0\u5f20\u56fe\u7247\u6216\u89c6\u9891\u7247\u6bb5\u518d\u52a0\u4e00\u6bb5\u80cc\u666f\u97f3\u4e50\uff0c\u5c31\u53ef\u4ee5\u5feb\u901f\u751f\u6210\u4e00\u4e2a\u5f88\u9177\u7684\u7684\u89c6\u9891\u77ed\u7247\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044641705\" alt=\"logo.png\" title=\"logo.png\" loading=\"lazy\"><\/p>\n<ul>\n<li>\n<h3>github\u5730\u5740\uff1a<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=X82mlBPky7Ly8l%2B%2FbyVNmw%3D%3D.Bnpeu1wV9Ut%2BNhxioaMCCKX1mTIaFD%2B44LPK6iwlOZ9RsVcQ8X2OpZ0p3e8Cal%2FV\" rel=\"noopener noreferrer\">https:\/\/github.com\/tnfe\/FFCreator<\/a><\/h3>\n<\/li>\n<li>\n<h3>\u6587\u6863\u5730\u5740\uff1a<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=3ABJ1nBiunXRnQK6cMvIww%3D%3D.syLQcRit7B2%2BBT29mhkY%2FSj512d4LzmYhRPiGLUE1kxg9TN%2BL093aeMT9DVXcrPo\" rel=\"noopener noreferrer\">https:\/\/tnfe.github.io\/FFCreator\/#\/<\/a><\/h3>\n<\/li>\n<\/ul>\n<h3>\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4f1a\u5e26\u9886\u4f60\u4ece\u5934\u5230\u5c3e\u5236\u4f5c\u4e00\u4e2a\u77ed\u89c6\u9891\u3002<\/h3>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044641706\" alt=\"02.jpg\" title=\"02.jpg\" loading=\"lazy\"><\/p>\n<h2>\u751f\u6210\u9879\u76ee\u5e76\u5b89\u88c5\u4f9d\u8d56<\/h2>\n<p>\u9996\u5148\u5f97\u5efa\u4e00\u4e2a\u9879\u76ee\uff0c\u7136\u540e\u6267\u884cnpm init\uff0c\u4e00\u987f\u56de\u8f66\u5c31\u597d\u4e86\u3002<\/p>\n<pre><code>mkdir ffcreator-example &amp;&amp; cd ffcreator-example\nnpm init<\/code><\/pre>\n<p>\u63a5\u4e0b\u6765\u8fdb\u884c\u4eca\u5929\u54b1\u4eec\u8fd9\u4e2a\u5305\u7684\u5b89\u88c5\u64cd\u4f5c<\/p>\n<pre><code class=\"js\">npm install ffcreator\nor\nyarn add ffcreator<\/code><\/pre>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044641707\" alt=\"a.jpg\" title=\"a.jpg\" loading=\"lazy\"><br \/><code>\u91cd\u4e2d\u4e4b\u91cd\uff0cffcreator\u4f9d\u8d56\u4e8eFFmpeg\uff0c\u56e0\u6b64\u5fc5\u987b\u5b89\u88c5FFmpeg<\/code>\u3002<\/p>\n<p>FFCreatorLite\u4f9d\u8d56\u4e8e<code>FFmpeg&gt;=0.9<\/code>\u4ee5\u4e0a\u7248\u672c\u3002\u8bf7\u8bbe\u7f6eFFmpeg\u4e3a\u5168\u5c40\u53d8\u91cf, \u5426\u5219\u9700\u8981\u4f7f\u7528setFFmpegPath\u6dfb\u52a0FFmpeg\u672c\u673a\u8def\u5f84\u3002(windows\u7528\u6237\u7684ffmpeg\u5f88\u53ef\u80fd\u4e0d\u5728\u60a8\u7684<code>%PATH<\/code>\u4e2d\uff0c\u56e0\u6b64\u60a8\u5fc5\u987b\u8bbe\u7f6e<code>%FFMPEG_PATH<\/code>)\u3002<\/p>\n<p>\u5b89\u88c5FFmpeg\u7684\u6559\u7a0b\uff0c\u6211\u53ea\u8bf4\u4e0bwindows\u548cmac\u7684\u54c8\uff0c\u5173\u4e8e\u5176\u4ed6\u7684\u5728\u4e0a\u9762github\u91cc\u9762\u6709\u66f4\u8be6\u7ec6\u7684\u8bf4\u660e\uff0c\u4e4b\u6240\u4ee5\u53ea\u8bf4\u4e0bwindows\u548cmac\uff0c\u56e0\u4e3a\u5bf9\u4e8e\u524d\u7aef\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u5927\u591a\u6570\u90fd\u662fmac\uff0c\u4e5f\u6709\u90e8\u5206window\u3002\u5bf9\u4e8e\u5176\u4ed6\u7814\u53d1\u4eba\u5458\uff0c\u5982\u679c\u60f3\u5c1d\u8bd5\u7684\u8bdd\uff0c\u53ef\u4ee5\u8fdb\u5230\u4e0a\u9762github\u67e5\u770b\u5176\u4ed6\u73af\u5883\u7684\u5b89\u88c5\u65b9\u5f0f\u3002<\/p>\n<h3>windows\uff1a<\/h3>\n<p>\u5171\u56db\u5206\u6b65\uff1a\u4e0b\u8f7d\u3001\u89e3\u538b\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u3002<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=pMEdBYUo18nxGEj%2BeA8eqw%3D%3D.2mzAlI%2BQ9tyipniPGPSN2F%2FwiY%2BxsNVwBkYDjQrBefU2NbL4EfCCjRCWttKNhyNvtiWqio7DacVeTUdGRE80ug%3D%3D\" rel=\"noopener noreferrer\">\u53c2\u8003\u6587\u6863<\/a><\/p>\n<h3>mac\uff1a<\/h3>\n<p>\u5171\u4e24\u90e8\u5206\uff1a<\/p>\n<ul>\n<li>\n<p>\u5b89\u88c5homebrew(\u5982\u5df2\u5b89\u88c5\uff0c\u53ef\u5ffd\u7565\uff0c\u76f4\u63a5\u8fdb\u884c\u4e0b\u4e00\u6b65)\uff1a<\/p>\n<pre><code class=\"js\">\/bin\/bash -c &quot;$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install.sh)&quot;<\/code><\/pre>\n<\/li>\n<li>\n<p>\u4f7f\u7528homebrew\u5b89\u88c5ffmpeg:<\/p>\n<pre><code class=\"js\">brew install ffmpeg<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=VQkPzjrWtau0Nskx%2F2B8WQ%3D%3D.zj8LnoGUg2cxSB8yzz6Q6kql0ja3jaD9TF%2Bp6M5VWbH2XA9GIMlSRt6p%2FlpgKlPoW%2B7UV2bYyagNUD9g5FT20g%3D%3D\" rel=\"noopener noreferrer\">\u53c2\u8003\u6587\u6863<\/a><\/p>\n<p>\u81f3\u6b64\uff0c\u9879\u76ee\u3001\u73af\u5883\u3001\u4f9d\u8d56\u90fdready\u4e86\uff0c\u6211\u4eec\u53ef\u4ee5\u8fdb\u884c\u4e0b\u4e00\u6b65\u7684\u64cd\u4f5c\u4e86\u3002<\/p>\n<h2>\u5173\u4e8e\u4f7f\u7528<\/h2>\n<p>ffcreator\u662f\u4e00\u4e2anode\u7684\u5e93\uff0c\u63d0\u4f9b\u4e86\u591a\u79cd\u6784\u9020\u51fd\u6570\u53ef\u4ee5\u8fdb\u884c\u4f7f\u7528\uff1a<\/p>\n<ul>\n<li>\n<p>FFScene, \/\/ \u5c4f\u5e55,\u4e5f\u79f0\u573a\u666f<\/p>\n<pre><code class=\"js\">\/\/ \u65b0\u5efa\u4e00\u4e2a\u663e\u793a\u5c4f\nconst scene = new FFScene();\n\/\/ \u8bbe\u7f6e\u80cc\u666f\u8272   \nscene.setBgColor('#30336b');    \n\/\/ \u8bbe\u7f6e\u505c\u7559\u65f6\u957f   \nscene.setDuration(8.5);             \n\/\/ \u8bbe\u7f6e\u8fc7\u6e21\u52a8\u753b(\u7c7b\u578b, \u65f6\u95f4)\nscene.setTransition('Fat', 1.5);    \n\/\/ \u628a\u5c4f\u5e55\u6dfb\u52a0\u5230\u89c6\u9891\u521b\u9020\u5668\u5b9e\u4f8b\u4e0a\u9762\ncreator.addChild(scene);<\/code><\/pre>\n<\/li>\n<li>FFNode, \u4e0b\u9762\u6240\u6709\u7c7b\u578b\u7684\u57fa\u7c7b\uff0c\u53ef\u4ee5\u76f4\u63a5\u770b\u4e0b\u9762\u3002<\/li>\n<li>\n<p>FFText, \u6587\u672c\u5143\u7d20<\/p>\n<pre><code class=\"js\">const text = new FFText({text: '\u8fd9\u662f\u4e00\u4e2a\u6587\u5b57', x: 250, y: 80});\n\/\/ \u6587\u5b57\u989c\u8272\ntext.setColor('#ffffff');         \n\/\/ \u80cc\u666f\u8272\ntext.setBackgroundColor('#b33771');         \n\/\/ \u51fa\u73b0\u52a8\u753b\u4e3afadeIn\uff0c\u52a8\u753b\u7684\u65f6\u957f1\u79d2\uff0cdelay\u65f6\u95f4\u4e3a1\u79d2\uff0c\ntext.addEffect(&quot;fadeIn&quot;, 1, 1);   \n\/\/ \u8bbe\u7f6e\u6587\u672c\u6c34\u5e73\u5c45\u4e2d\ntext.alignCenter();                         \n\/\/ \u8bbe\u7f6e\u6837\u5f0fobject \ntext.setStyle({padding: [4, 12, 6, 12]});   \n\/\/ \u628a\u5f53\u524d\u6587\u672c\u8282\u70b9\u6dfb\u52a0\u5230\u5c4f\u5e55\u4e0a\u9762\nscene.addChild(text);<\/code><\/pre>\n<\/li>\n<li>\n<p>FFImage, \u56fe\u7247\u5143\u7d20<\/p>\n<pre><code class=\"js\">\/\/ \u521b\u5efa\u4e00\u4e2a\u56fe\u7247\u5143\u7d20\uff0c\u56fe\u7247\u8def\u5f84\u4e3a..\/images\/demo.png\nconst img = new FFImage({path: '..\/images\/demo.png'});\n\/\/ \u8bbe\u7f6e\u4f4d\u7f6e   \nimg.setXY(250, 340);                \n\/\/ \u8bbe\u7f6e\u7f29\u653e\nimg.setScale(2);                   \n\/\/ \u8bbe\u7f6e\u65cb\u8f6c   \nimg.setRotate(45);               \n\/\/ \u8bbe\u7f6e\u900f\u660e\u5ea6 \nimg.setOpacity(0.3);                \n\/\/ \u8bbe\u7f6e\u5bbd\u9ad8\nimg.setWH(100, 200);                \n\/\/ \u8bbe\u7f6e\u52a8\u753b\u6548\u679c\n\/\/ \u8bbe\u7f6e\u52a8\u753b\u6548\u679c\u4e3aslideInDown\uff0c\u52a8\u753b\u65f6\u957f\u4e3a1.2\u79d2\uff0cdelay\u65f6\u95f4\u4e3a0\nimg.addEffect(&quot;slideInDown&quot;, 1.2, 0);\n\/\/ \u628a\u5f53\u524d\u56fe\u7247\u8282\u70b9\u6dfb\u52a0\u5230\u5c4f\u5e55\u4e0a\u9762\nscene.addChild(img);<\/code><\/pre>\n<\/li>\n<li>\n<p>FFVideo, \u89c6\u9891\u5143\u7d20<\/p>\n<pre><code class=\"js\">\/\/ \u521b\u5efa\u4e00\u4e2a\u89c6\u9891\u5143\u7d20\uff0c\u89c6\u9891\u8def\u5f84\u4e3a..\/videos\/demo.mp4\uff0c\u4f4d\u7f6e\u5728\u5c4f\u5e55\u7684100\u548c150\u5904\n\/\/ \u5bbd\u5ea6\u4e3a500\uff0c\u9ad8\u5ea6\u4e3a350.\nconst video = new FFVideo({\n    path: videopath,\n    x: 100,\n    y: 150,\n    width: 500,\n    height: 350\n});\n\u8bbe\u7f6e\u662f\u5426\u6709\u97f3\u4e50\nvideo.setAudio(true);  \n\/\/ \u8bbe\u7f6e\u662f\u5426\u5faa\u73af\u64ad\u653e\nvideo.setLoop(true);\n\/\/ \u622a\u53d6\u64ad\u653e\u65f6\u957f,\u8bbe\u7f6e\u89c6\u9891\u64ad\u653e\u7684\u5f00\u59cb\u65f6\u95f4\u548c\u7ed3\u675f\u65f6\u95f4\nvideo.setTimes(&quot;00:00:43&quot;, &quot;00:00:50&quot;);\n\/\/ \u5355\u72ec\u8bbe\u7f6e\u89c6\u9891\u64ad\u653e\u7684\u5f00\u59cb\u65f6\u95f4\nvideo.setStartTime(&quot;00:00:43&quot;),\n\/\/ \u5355\u72ec\u8bbe\u7f6e\u89c6\u9891\u64ad\u653e\u7684\u7ed3\u675f\u65f6\u95f4\nvideo.setEndTime(&quot;00:00:50&quot;),\n\/\/ video\u8fd8\u6709\u5f88\u591a\u5176\u4ed6\u7684\u65b9\u6cd5\n...\n\/\/ \u628a\u5f53\u524d\u89c6\u9891\u5143\u7d20\u6dfb\u52a0\u5230\u5c4f\u5e55\u4e0a\u9762\nscene.addChild(video);<\/code><\/pre>\n<\/li>\n<li>\n<p>FFAlbum, \u76f8\u518c\u5143\u7d20<\/p>\n<pre><code class=\"js\">\/\/ \u65b0\u5efa\u76f8\u518c\u5143\u7d20\u3002\nconst album = new FFAlbum({\n    list: [img1, img2, img3, img4],   \/\/ \u76f8\u518c\u7684\u56fe\u7247\u96c6\u5408\n    x: 250,\n    y: 300,\n    width: 500,\n    height: 300,\n});\n \/\/ \u8bbe\u7f6e\u76f8\u518c\u5207\u6362\u52a8\u753b\nalbum.setTransition('zoomIn');     \n\/\/ \u8bbe\u7f6e\u5355\u5f20\u505c\u7559\u65f6\u957f\nalbum.setDuration(2.5);             \n\/\/ \u8bbe\u7f6e\u5355\u5f20\u52a8\u753b\u65f6\u957f\nalbum.setTransTime(1.5);            \nscene.addChild(album);\n\/\/ \u628a\u5f53\u524d\u76f8\u518c\u5143\u7d20\u6dfb\u52a0\u5230\u5c4f\u5e55\u4e0a\u9762\nscene.addChild(video);<\/code><\/pre>\n<\/li>\n<li>\n<p>FFVtuber, \u865a\u62df\u4e3b\u64ad\u5f62\u8c61<\/p>\n<pre><code class=\"js\">const vtuber = new FFVtuber({ x: 100, y: 400 });\n\/\/ \u8bbe\u7f6e\u52a8\u753b\u65f6\u95f4\u5faa\u73af\u5468\u671f\nvtuber.setPeriod([\n    [0, 3],\n    [0, 3]\n]);\n\/\/ \u8def\u5f84\u8bbe\u7f6e\u8fd9\u91cc baby\/[d].png \u548c baby\/%d.png \u4e24\u79cd\u65b9\u5f0f\u5747\u53ef\u4ee5\nconst vpath = path.join(__dirname, &quot;.\/avator\/baby\/[d].png&quot;);\n \/\/ \u4ece\u7b2c1-7.png\nvtuber.setPath(vpath, 1, 7);   \n\/\/ \u64ad\u653e\u901f\u5ea6\nvtuber.setSpeed(6);             \ncreator.addVtuber(vtuber);<\/code><\/pre>\n<\/li>\n<li>\n<p>FFSubtitle, \u5b57\u5e55\u5143\u7d20<\/p>\n<pre><code class=\"js\">const content = '\u8ddf\u8ba1\u7b97\u673a\u5de5\u4f5c\u9177\u5c31\u9177\u5728\u8fd9\u91cc\uff0c\u5b83\u4eec\u7279\u522b\u542c\u8bdd\uff0c\u8bf4\u8ba9\u5e72\u4ec0\u4e48\u5c31\u5e72\u4ec0\u4e48...';\nconst subtitle = new FFSubtitle({\n    text: content,\n    comma: true,                  \/\/ \u662f\u5426\u9017\u53f7\u5206\u5272\n    backgroundColor: '#00219C',   \/\/ \u80cc\u666f\u8272\n    color: '#fff',                \/\/ \u6587\u5b57\u989c\u8272\n    fontSize: 24                  \/\/ \u5b57\u53f7\n});\n\/\/ \u8bbe\u7f6e\u6587\u6848\uff0c\u4e5f\u53ef\u4ee5\u653e\u5230conf\u91cc\nsubtitle.setText(content);      \n\/\/ \u7f13\u5b58\u5e27\nsubtitle.frameBuffer = 24;      \n\/\/ \u8bbe\u7f6e\u5b57\u5e55\u603b\u65f6\u957f\nsubtitle.setDuration(12);       \nscene.addChild(subtitle);\n\/\/ \u8bbe\u7f6e\u8bed\u97f3\u914d\u97f3-tts\nsubtitle.setSpeech(dub);        <\/code><\/pre>\n<\/li>\n<li>FFTween, \u6e10\u53d8<\/li>\n<\/ul>\n<p>\u9664\u4e86\u4e0a\u9762\u51e0\u79cd\u7c7b\u578b\u4e4b\u5916\uff0c\u8fd8\u6709\u5b9e\u4f8b\u548c\u8fd0\u884c\uff1a<\/p>\n<ul>\n<li>\n<p>FFCreator,\/\/ \u521b\u5efa\u4e00\u4e2a\u5b9e\u4f8b<\/p>\n<pre><code class=\"js\">const creator = new FFCreator({\n  cacheDir,                 \/\/ \u7f13\u5b58\u76ee\u5f55\n  outputDir,                \/\/ \u8f93\u51fa\u76ee\u5f55\n  output,                   \/\/ \u8f93\u51fa\u6587\u4ef6\u540d(FFCreatorCenter\u4e2d\u53ef\u4ee5\u4e0d\u8bbe)\n  width: 500,               \/\/ \u5f71\u7247\u5bbd\n  height: 680,              \/\/ \u5f71\u7247\u9ad8\n  audioLoop: true,          \/\/ \u97f3\u4e50\u5faa\u73af\n  fps: 24,                  \/\/ fps\n  threads: 4,               \/\/ \u591a\u7ebf\u7a0b(\u4f2a\u9020)\u5e76\u884c\u6e32\u67d3\n  debug: false,             \/\/ \u5f00\u542f\u6d4b\u8bd5\u6a21\u5f0f\n  defaultOutputOptions: null,\/\/ ffmpeg\u8f93\u51fa\u9009\u9879\u914d\u7f6e\n});\n\n\/\/ \u5f80\u521b\u9020\u5668\u5b9e\u4f8b\u91cc\u9762\u6dfb\u52a0\u5c4f\u5e55\ncreator.addChild(scene);\n\/\/ \u521b\u9020\u5668\u7684\u5f00\u59cb\u51fd\u6570\u3002\u542f\u52a8\u3002\ncreator.start();\n<\/code><\/pre>\n<\/li>\n<li>FFCreatorCenter, \/\/ \u6838\u5fc3\u8fd0\u884c\u5e93\uff0c\u901a\u8fc7addTask\u7684\u65b9\u5f0f\u53bb\u8fd0\u884c<\/li>\n<\/ul>\n<pre><code class=\"js\">\/\/ \u53ef\u4ee5\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u542f\u52a8\u591a\u4e2a\u4efb\u52a1\uff0c\nFFCreatorCenter.addTask(createFFTask)\n\u5f53\u7136\u4e5f\u53ef\u4ee5\u4e0d\u4f7f\u7528FFCreatorCenter\uff0c\u76f4\u63a5\u8fd0\u884c\ncreateFFTask();<\/code><\/pre>\n<h2>\u6709demo\u7684\u54e6<\/h2>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044641709\" alt=\"a.gif\" title=\"a.gif\" loading=\"lazy\"><\/p>\n<ul>\n<li>\u56fe\u7247\u52a8\u753b\uff1a<\/li>\n<\/ul>\n<p>&lt;video controls=&quot;controls&quot; width=&quot;350&quot; height=&quot;622&quot;&gt;<\/p>\n<pre><code>&lt;source type=&quot;video\/mp4&quot; src=&quot;https:\/\/tnfe.github.io\/FFCreator\/_media\/video\/normal\/01.mp4&quot;&gt;<\/code><\/pre>\n<p>&lt;\/video&gt;<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=aHvG7OB2TRXLonzMGrmFig%3D%3D.yyD9Lh68BFPELBNt5A5GpfYgc%2FWHYAVPkMQY6ZcaDyj2Lgdj9%2BBen6Kixnr3WgUhKhJrg%2ByytBPqicIL12nqJuGUmoVHtHDAo4iHVatTES140cMAzWc1jpEqXvcUkzcz\" rel=\"noopener noreferrer\">\u56fe\u7247\u52a8\u753bdemo\u5730\u5740<\/a>, <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=cr8LCZ7MQJxrUqTG1kP4MQ%3D%3D.gjLOpIgyl4Ms37tZkfeQKmsjBQlZO4WjzGBtvZ3JGiKlDmb6E4DW1TqD9zdOGWjmKO2FRQqsy97zjfn1uvOJVw%3D%3D\" rel=\"noopener noreferrer\">demo\u6e90\u7801\u5730\u5740<\/a><\/p>\n<ul>\n<li>\u591a\u56fe\u76f8\u518c\uff1a<\/li>\n<\/ul>\n<p>&lt;video controls=&quot;controls&quot; width=&quot;350&quot; height=&quot;622&quot;&gt;<\/p>\n<pre><code>&lt;source type=&quot;video\/mp4&quot; src=&quot;https:\/\/tnfe.github.io\/FFCreator\/_media\/video\/normal\/02.mp4&quot;&gt;<\/code><\/pre>\n<p>&lt;\/video&gt;<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=UwkEwDU69FdlS0OR5WZ82w%3D%3D.gGFAu%2FAkXH76Y8jJYjWUq%2FKM%2FfYUJnMDAjKNoH2wYAqc8pe%2FZVwPqDyuVUc%2BHwkEAyGRLtS%2BHZxqP40hvIqDRJ1MxGMgPGkH6YZ%2BwPYXhLmbGcH1VQjgo3XZ%2B5y4NjLU\" rel=\"noopener noreferrer\">\u591a\u56fe\u76f8\u518cdemo\u5730\u5740<\/a>, <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=uoem5HihEWfEdenHTDGe2g%3D%3D.5JIa31LQS9zA01YVlcx4zjFh5FjT0JP0rhaaIyqhcphFY2CmVpOjSK%2BMav%2F0tuoJATJSG269EepVnRzHGJYo9A%3D%3D\" rel=\"noopener noreferrer\">demo\u6e90\u7801\u5730\u5740<\/a><\/p>\n<ul>\n<li>\u573a\u666f\u8fc7\u6e21\uff1a<\/li>\n<\/ul>\n<p>&lt;video controls=&quot;controls&quot; width=&quot;350&quot; height=&quot;622&quot;&gt;<\/p>\n<pre><code>&lt;source type=&quot;video\/mp4&quot; src=&quot;https:\/\/tnfe.github.io\/FFCreator\/_media\/video\/normal\/03.mp4&quot;&gt;<\/code><\/pre>\n<p>&lt;\/video&gt;<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=zSGrlPD0Q%2Bm3TkxHpV358g%3D%3D.XQwcbtPxIBmyeSJJNmXiiLvwKruvKpPTbbEJZWiFi5tlzE1kxO0CTTmIcxmvSb30%2BmpoawT0XZg%2Fh7tJV1sUgkgGbcKtqkR1eLAQEE3eahouWd%2BS4VlmgN9AX1WT8y%2Bg\" rel=\"noopener noreferrer\">\u573a\u666f\u8fc7\u6e21demo\u5730\u5740<\/a>, <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=y1s2kn78oTzHaw7h9DvZKg%3D%3D.g%2Fl%2FNZPrtGqXAatohEFVQ89pIVUL1V%2FYvstV%2BtYR0voL86OsbB%2Fws072Ne3yeMuqt3Hk6UTCiIQnVVROblcT3EKJ%2FTIQO1SF9x7TpN8IpI0%3D\" rel=\"noopener noreferrer\">demo\u6e90\u7801\u5730\u5740<\/a><\/p>\n<ul>\n<li>\u914d\u97f3\u5b57\u5e55\uff1a<\/li>\n<\/ul>\n<p>&lt;video controls=&quot;controls&quot; width=&quot;350&quot; height=&quot;622&quot;&gt;<\/p>\n<pre><code>&lt;source type=&quot;video\/mp4&quot; src=&quot;https:\/\/tnfe.github.io\/FFCreator\/_media\/video\/normal\/04.mp4&quot;&gt;<\/code><\/pre>\n<p>&lt;\/video&gt;<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=QR7Dgy52Zq2qqJcs3vLrtw%3D%3D.wTkthmdT3POf8RE%2FgMaHQegzXrxUqiGw%2BGbYHO4JbSVkZGZ8FcQtx7JLiBqtv4TWkIxZKK46e9l49fueoPFND99%2B9Vg20ZuQGuwcuTMtc7ghOQOQ3cHVkH9aQ1thaLqg\" rel=\"noopener noreferrer\">\u914d\u97f3\u5b57\u5e55demo\u5730\u5740<\/a>, <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=P0dtDGnf6YZCNVz2wK43VQ%3D%3D.5AtDCycDzRpl%2Fo5Uo1UXKftafRZnXfGiTwkJxt1PeiRP5R1fIrcEejHf5kQw4ETtPGhIY23vWD8NYOxeuzYLizrw2%2B2QWKd%2F7L1%2BGrCodos%3D\" rel=\"noopener noreferrer\">demo\u6e90\u7801\u5730\u5740<\/a><\/p>\n<ul>\n<li>\u89c6\u9891\u52a8\u753b\uff1a<\/li>\n<\/ul>\n<p>&lt;video controls=&quot;controls&quot; width=&quot;350&quot; height=&quot;622&quot;&gt;<\/p>\n<pre><code>&lt;source type=&quot;video\/mp4&quot; src=&quot;https:\/\/tnfe.github.io\/FFCreator\/_media\/video\/normal\/05.mp4&quot;&gt;<\/code><\/pre>\n<p>&lt;\/video&gt;<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=AZ2qe6w7LDWPszdGuORw%2Fg%3D%3D.4nOT9JlusJaTB08badrNIkG0p%2FR8L4WRtQNtAhP%2BinqYf7WKo0Dl7LSae1c5rMUpuf0FcxIv2qvXUy3YV4qL1UoME07rb6OvBQK4wKZ%2BDlEhld4Ky03SI%2BMV%2F%2B5yqQnJ\" rel=\"noopener noreferrer\">\u89c6\u9891\u52a8\u753bdemo\u5730\u5740<\/a>, <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=t%2FWaleQ%2FnvUHF7PoBKTzyg%3D%3D.p%2B%2FPw8YNBLdJvm1DGHTiD6qhWap%2FQUN3jtQ2SmvkkW4ia6sP5S1MNEVtxty%2BvCD1HdSPpOeWpyB16vmeA7y3lA%3D%3D\" rel=\"noopener noreferrer\">demo\u6e90\u7801\u5730\u5740<\/a><\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044641710\" alt=\"b.gif\" title=\"b.gif\" loading=\"lazy\"><\/p>\n<h2>\u5199\u5728\u6700\u540e<\/h2>\n<p>\u77ed\u89c6\u9891\u6a2a\u884c\u4e92\u8054\u7f51\uff0c\u4f55\u4e0d\u987a\u5e94\u6f6e\u6d41\uff0c\u7528\u4ee3\u7801\u53bb\u5b9e\u73b0\u77ed\u89c6\u9891\u7684\u521b\u4f5c\u5462\uff1f<\/p>\n<p>\u65e2\u7136\u53ef\u4ee5node\u5b9e\u73b0\u77ed\u89c6\u9891\u7684\u521b\u9020\uff0c\u4f55\u4e0d\u642d\u914d\u670d\u52a1\u5668\uff0c\u5b9e\u73b0\u62d6\u62fd\u7ec4\u5408\uff0c<strong>\u53ef\u89c6\u5316\u751f\u6210\u77ed\u89c6\u9891<\/strong>\u5462\uff1f<\/p>\n<p>\u5982\u679c\u4f60\u8fc7\u5f97\u5feb\u4e50\uff0c\u8bf7\u52aa\u529b\u5de5\u4f5c\u4f7f\u81ea\u5df1\u66f4\u5feb\u4e50\uff1b\u5982\u679c\u4e0d\u8fc7\u5f97\u4e0d\u5feb\u4e50\uff0c\u8bf7\u52aa\u529b\u5de5\u4f5c\u8ba9\u81ea\u5df1\u53d8\u5f97\u5feb\u4e50\uff1b\u603b\u4e4b\uff0c\u5de5\u4f5c\u4f7f\u6211\u5feb\u4e50~<\/p>\n<p>\u795d\u5927\u5bb6\u5de5\u4f5c\u987a\u5229\uff0c\u5929\u5929\u5feb\u4e50\u54e6~<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044641702\">https:\/\/segmentfault.com\/a\/1190000044641702<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>theme: fancy TNTWeb &#8211; \u5168\u79f0\u817e\u8baf\u65b0\u95fb\u524d\u7aef\u56e2\u961f\uff0c\u7ec4\u5185\u5c0f\u4f19\u4f34\u5728Web\u524d\u7aef\u3001Node [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008371","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008371"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008371\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}