After Effects/ExtendScript:使用库并导入.jsx文件?

dan*_*ani 9 after-effects extendscript jsx

我是After Effects脚本的新手,但在浏览器中有很多JavaScript经验.

  1. 如何导入.jsx文件?
  2. 我可以使用诸如underscore.js之类的js库吗?
  3. AE脚本有哪些好的资源?(理想的信息图表项目)

fab*_*fas 16

  1. 在脚本旁边包含.jsx

使用:

#include "includeme.jsx"
Run Code Online (Sandbox Code Playgroud)

编辑2:

您还可以使用以下语法包含文件:

//@include "includeme.jsx"
Run Code Online (Sandbox Code Playgroud)

哪个(恕我直言)是更好的方式.它不会破坏一个短信,更多的是javascript-ish.

  1. 您可以使用普通的旧javascript(ES3语法).如果您包含的库使用某些特定于浏览器的js(如console.log()),则会出现错误

  2. 最佳资源是AECS6脚本指南.您可以在http://aescripts.com上查看 许多开源脚本

编辑1: 您还可以包含这样的文件.

var path = ((File($.fileName)).path); // this is the path of the script
// now build a path to another js file
// e.g. json lib https://github.com/douglascrockford/JSON-js
var libfile = File(path +'/_libs/json2.js');
if(libfile.exists){
  $.evalFile(libfile);
}
Run Code Online (Sandbox Code Playgroud)