Is it possible to save all my custom expressions inside an external .jsx file, so I can call them from inside my projects?
For example, let's say I have an expression I use a lot, that ties a puppet tool point to a null object's position. I know I can I transform that expression into a function that could take, say, two arguments, but can I save it into a custom library, so that I can easily re-use it inside the project?
Right now, I'm simply copying and pasting the same code from property to property, and I'm beginning to feel there is an alternative way to do this more efficiently.
Thanks in advance!
I tested this with success, put this on top of your expression:
$.evalFile("/Users/myname/ae/functions.txt");
Then you can access whatever functions you have in your functions.txt file.
See here for more details: https://forums.creativecow.net/readpost/227/29337
The problem with this method is that you still need to include the extra line for each expression.
Anyway here is my complete setup, just in case: my expression is:
$.evalFile("/Users/myname/ae/functions.txt");
var p1 = thisComp.layer("Null 1").transform.position;
var p2 = thisComp.layer("Null 4").transform.position;
var p = p2 - p1;
printPosition(p)
And my functions.txt file contains the following:
function printPosition (p){
return " " + parseInt(p[0]) + " : " + parseInt(p[1])
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With