I am trying to write a script for after effects CC using Extendscript. I wonder if it is possible to add live expressions to a layers properties like thisComp.layer("Layer 1").transform.position
and so on.
Hoping it is possible.
Thanks in advance :)
This should work for you.
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;
}
Replace the index
with your layers index
and item index
. If you use strings in your expression like
thisComp.layer(\"My-Layer\").transform.position
You need to escape them properly. Don't use single quotation marks in your expressions. e.g. 'My-Layer'
. This creates new problems.
Take a look into the After-Effects-CS6-Scripting-Guide.pdf