使用 Extendscript 在 After effects cc 中编写实时表达式



我正在尝试使用Extendscript为After Effects CC编写脚本。我想知道是否可以将实时表达式添加到图层属性中,例如thisComp.layer("Layer 1").transform.position等。

希望有可能。

提前致谢:)

这应该适合你。

var expString = "thisComp.layer("My-Layer").transform.position";
var prop = app.project.item(index).layer(index).transform.position;
if(prop.canSetExpression === true){
    prop.expression  = expString;
}

index替换为图层index和项目index。如果您在表达式中使用字符串,例如

thisComp.layer("My-Layer").transform.position  

您需要正确转义它们。不要在表达式中使用单引号。例如 'My-Layer' .这会产生新的问题。

查看 After-Effects-CS6-Scripting-Guide.pdf

最新更新