ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

In theory, how many times will this code run

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jakob Wagner
In theory, how many times will this code run
on Jun 9, 2017 at 10:54:13 am

Hi

OK. A crazy Friday experiment. Basically I'm trying to optimise the way I execute expressions.
It doesn't really matter what the code does, this is about the structure of it.

I have a text layer. In Source Text I have this expression:

var numLayers = 3;
var scaleString = "[";

for(var i=0;i<numLayers;i++)
{
scaleString += i==0?"":",";
scaleString += "["+(100*i+100)+","+(100*i+100)+"]";
}
scaleString += "]";

"var data = " + scaleString;


Then I have three shape layers. All of them have this expression in their scale property:

eval(thisComp.layer("data").text.sourceText.value);
data[index-1];


So, the big question is: How many times will the code in the Source Text property run? Once? Or once for each shape layer referencing it?

Did that make sense? Let me know if not.
Here is a example download: https://f1.creativecow.net/file/11432/11432_testloop.aep.zip

Thanks,
Jakob


Return to posts index

Xavier Gomez
Re: In theory, how many times will this code run
on Jun 9, 2017 at 6:55:13 pm

What is sure is that the string is build at least once for the text layer, and is evaluated three different times, once per shape layer.
Now, is the string rebuilt everytime it is required by one of the shape layers, that's a question i always wondered about. I would say no, but that's just a guess. Only an Adobe engineer could answer i think. Or maybe Dan!

Xavier


Return to posts index

Jakob Wagner
Re: In theory, how many times will this code run
on Jun 14, 2017 at 9:07:26 am

I guess it will be left to the unknown for now. No matter what the answer is, it never really gave me any performance improvement any ways.

Thank you for answering. :)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]