Page 1 of 1

Call expression from script

Posted: October 22nd, 2021, 5:32 am
by zcream

How can I obtain the value of an expression from within a script ?

For example

Code: Select all

length(this_comp.layer("A").position, this_comp.layer("B").position);

The scripting engine does not recognize length().


Re: Call expression from script

Posted: October 25th, 2021, 9:54 pm
by zlovatt

You could apply the expression to a property:

Code: Select all

property.expression = "wiggle(0.5, 100)";

and then get the post-expression value of the property;

Code: Select all

var expressionResult = property.valueAtTime(comp.time, false);