如何使用 ExtendScript 更改 After Effects 2017 中文本图层的颜色



我需要知道如何使用 ExtendScript 在 After Effects 2017 中更改文本图层的颜色。我可以非常简单地更改文本本身,如下所示:

var comp=app.project.item(10);
comp.layer(1).property('Source Text').setValue('My Text Here');

但是如何设置该文本图层的颜色呢?我认为这将非常简单,但尽管进行了大量搜索,但我还没有找到任何清楚地解释如何做到这一点的东西。

提前感谢!

After

Effects CS6 脚本指南(Adobe 为我们提供的最新文档)的第 182 页描述了 TextDocument 对象,该对象是文本图层的源文本属性的数据类型。属性包括 fillColor 和 strokeColor。

编辑 它并不像看起来那么简单,您不能只将值分配给源文本,您必须创建一个新的 textDocument 对象,对其进行更改,然后将源文本属性的值分配给您创建的 textDocument 对象。

因此,您可以这样设置它:

var textProp = comp.layer(1).property('Source Text');
//make a new textDocument, copying the values of the current one
var textDocument = textProp.value;
// change any attributes of the textDocument here, e.g.:
textDocument.fillColor = [R, G, B];
// write the textDocument over the existing one
textProp.setValue(textDocument);

R、G 和 B 是浮点值,其中 1.0 ⇒ 255 为 8 位颜色。

你也可以在aeenhancers上看到在线的脚本指南有一个拼写错误,它描述了构造函数,它说newTextDocument它应该new TextDocument

最新更新