After Effects/ExtendScript:使用库并导入.jsx文件吗? [英] After Effects / ExtendScript: Using libraries and importing .jsx files?

查看:282
本文介绍了After Effects/ExtendScript:使用库并导入.jsx文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

推荐答案

  1. 在脚本旁边添加一个.jsx

使用:

#include "includeme.jsx"

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

You can also include files using the following syntax:

//@include "includeme.jsx"

哪个(IMHO)是更好的方法.它不会破坏短绒,并且具有更多的javascript-ish效果.

Which (IMHO) is the better way. It wont break a linter and is more javascript-ish.

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

最佳资源是

Best resource is the AECS6 scripting guide. There are also lots of open source scripts on http://aescripts.com that you can examine

您还可以包含这样的文件.

EDIT 1: You can also include a file like this.

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);
}

这篇关于After Effects/ExtendScript:使用库并导入.jsx文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆