Note This article is deprecated. I have published an updated version: Obfuscate expressions in 2022.
One day or another there might be the moment to think about securing your brainwork that you spent on expressions.
A solution is to compile the expression like a script in Adobe Extendscript Toolkit. After Effects can handle this compiled code like regular source code.
Unfortunately this solution only works for the Expression Engine "Extendscript" not the new "Javscript".
"Using eval() with binary-encoded (.jsxbin) expressions
- You need the Adobe Extendscript Toolkit. It contains the function to compile your code.
- Take the expression you want to "compile" and paste it in Extendscript Toolkit. My example is wiggle(2,20);
- Export a .jsxbin-File.
- Open the file in a text editor. The content is something like this
- Copy the whole content back into the place in After Effects where you used the source expression.
- The last thing to do is to let After Effects use the new code correctly which is done by putting it all in a eval-function. I.e.
Some useful information:
It is not obligatory to compile the whole expression. I.e. you can leave a declaration of a variable outside of it but still use it in the compiled code and vice versa.
var x = 20; // code to compile wiggle(2,x); //
The compiled version would be
var x = 20; eval("@JSXBIN@ES@2.0@MyBbyBn0ABJAnAEjzGjXjJjHjHjMjFBfRCFdCjzBjYCfff0DzADByB");