{"id":6213,"date":"2024-09-22T13:58:10","date_gmt":"2024-09-22T05:58:10","guid":{"rendered":"http:\/\/www.snailer.xyz\/?page_id=6213"},"modified":"2024-09-22T13:58:14","modified_gmt":"2024-09-22T05:58:14","slug":"%e6%97%b6%e9%92%9f%e6%95%88%e6%9e%9c%e5%99%a8-%e4%bb%a3%e7%a0%81%e5%b1%95%e7%a4%ba","status":"publish","type":"page","link":"http:\/\/www.snailer.xyz\/index.php\/%e6%97%b6%e9%92%9f%e6%95%88%e6%9e%9c%e5%99%a8-%e4%bb%a3%e7%a0%81%e5%b1%95%e7%a4%ba\/","title":{"rendered":"\u65f6\u949f\u6548\u679c\u5668 \u4ee3\u7801\u5c55\u793a"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u4e3aAE\u4f7f\u7528\u7684\u811a\u672c\uff0c\u7528\u4e8e\u6a21\u62df\u65f6\u949f\u7684\u8fd0\u52a8\u6548\u679c\u3002<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>function SecondHandEffectScript() {\n    var scriptWindow = new Window(\"palette\", \"\u65f6\u949f\u6548\u679c\u56681.1 \u4f5c\u8005 b\u7ad9\uff1a\u543e\u79c0\u7684\u4e2b\u6279\", undefined, {resizeable: true});\n    scriptWindow.orientation = \"column\";\n    scriptWindow.alignChildren = &#91;\"fill\", \"fill\"];\n\n    scriptWindow.layerText = scriptWindow.add(\"statictext\", undefined, \"\u5df2\u9009\u62e9\u7684\u56fe\u5c42\uff1a\u65e0\");\n    scriptWindow.selectButton = scriptWindow.add(\"button\", undefined, \"\u9009\u62e9\u56fe\u5c42\");\n    var selectedLayer = null;\n\n    scriptWindow.grp = scriptWindow.add(\"group\");\n    scriptWindow.grp.orientation = \"row\";\n\n    scriptWindow.grp.add(\"statictext\", undefined, \"\u6bcf\u79d2\u5237\u65b0\u6b21\u6570\uff1a\");\n    var ticksField = scriptWindow.grp.add(\"edittext\", undefined, \"1\");\n    ticksField.characters = 4;\n    scriptWindow.grp.add(\"statictext\", undefined, \"\u6bcf\u6b21\u79fb\u52a8\u89d2\u5ea6\uff1a\");\n    var degreesField = scriptWindow.grp.add(\"edittext\", undefined, \"6\");\n    degreesField.characters = 4;\n\n    scriptWindow.predefinedType = scriptWindow.add(\"dropdownlist\", undefined, &#91;\"\u81ea\u5b9a\u4e49\", \"\u79d2\u9488\", \"\u5206\u9488\", \"\u65f6\u9488\"]);\n    scriptWindow.predefinedType.selection = 0;\n    scriptWindow.refreshController = scriptWindow.add(\"checkbox\", undefined, \"\u542f\u7528\u5237\u65b0\u63a7\u5236\uff08\u4e0d\u542f\u7528\u5219\u8fdb\u884c\u5e73\u6ed1\u8fd0\u52a8\uff09\");\n\n    var applyButton = scriptWindow.add(\"button\", undefined, \"\u5e94\u7528\u6548\u679c\");\n\n    scriptWindow.selectButton.onClick = function () {\n        var comp = app.project.activeItem;\n        if (comp &amp;&amp; comp instanceof CompItem &amp;&amp; comp.selectedLayers.length == 1) {\n            selectedLayer = comp.selectedLayers&#91;0];\n            scriptWindow.layerText.text = \"\u5df2\u9009\u62e9\u7684\u56fe\u5c42\uff1a\" + selectedLayer.name;\n        } else {\n            alert(\"\u8bf7\u5728\u5f53\u524d\u5408\u6210\u4e2d\u9009\u62e9\u4e00\u4e2a\u56fe\u5c42\u3002\");\n        }\n    };\n\n    scriptWindow.predefinedType.onChange = function () {\n        var preset = scriptWindow.predefinedType.selection.index;\n        switch (preset) {\n            case 1:\n                \/\/ \u79d2\u9488\u9884\u8bbe\n                ticksField.text = \"1\";\n                degreesField.text = \"6\";\n                break;\n            case 2:\n                \/\/ \u5206\u9488\u9884\u8bbe\n                ticksField.text = \"1\";\n                degreesField.text = \"1\/10\";\n                break;\n            case 3:\n                \/\/ \u65f6\u9488\u9884\u8bbe\n                ticksField.text = \"1\";\n                degreesField.text = \"1\/120\";\n                break;\n        }\n    };\n\n    applyButton.onClick = function () {\n        if (selectedLayer === null) {\n            alert(\"\u8bf7\u5148\u9009\u62e9\u4e00\u4e2a\u56fe\u5c42\u3002\");\n            return;\n        }\n        app.beginUndoGroup(\"\u5e94\u7528\u65f6\u949f\u6548\u679c\");\n        var effectExpression = \"ticksPerSecond = \" + ticksField.text + \";\\n\" +\n                               \"degreesPerTick = \" + degreesField.text + \";\\n\" +\n                               \"frameRate = 1 \/ thisComp.frameDuration;\\n\" +\n                               \"ticks = Math.floor(time * frameRate);\\n\" +\n                               \"ticksPerFrame = frameRate \/ ticksPerSecond;\\n\";\n\n        if (scriptWindow.refreshController.value) {\n            effectExpression += \"Math.floor(ticks \/ ticksPerFrame) * degreesPerTick;\";\n        } else {\n            effectExpression += \"time * degreesPerTick * ticksPerSecond;\";\n        }\n\n        selectedLayer.property(\"ADBE Transform Group\").property(\"ADBE Rotate Z\").expression = effectExpression;\n        app.endUndoGroup();\n        alert(\"\u5df2\u5c06\u65f6\u949f\u6548\u679c\u5e94\u7528\u4e8e\u56fe\u5c42\uff1a\" + selectedLayer.name);\n    };\n\n    scriptWindow.layout.layout(true);\n    scriptWindow.layout.resize();\n    scriptWindow.onResizing = scriptWindow.onResize = function () {\n        this.layout.resize();\n    };\n\n    scriptWindow.center();\n    scriptWindow.show();\n}\n\nif (parseFloat(app.version) &lt; 14) {\n    alert(\"\u8be5\u811a\u672c\u9700\u8981 Adobe After Effects CC 2017 \u6216\u66f4\u9ad8\u7248\u672c\u3002\");\n} else {\n    SecondHandEffectScript();\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3aAE\u4f7f\u7528\u7684\u811a\u672c\uff0c\u7528\u4e8e\u6a21\u62df\u65f6\u949f\u7684\u8fd0\u52a8\u6548\u679c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-6213","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/pages\/6213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=6213"}],"version-history":[{"count":1,"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/pages\/6213\/revisions"}],"predecessor-version":[{"id":6215,"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/pages\/6213\/revisions\/6215"}],"wp:attachment":[{"href":"http:\/\/www.snailer.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=6213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}