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
Expressions encoded in the ExtendScript binary format (saved as a binary .jsxbin file from ExtendScript ToolKit CC) are not supported by the JavaScript engine. If you want to obfuscate an expression, use the Legacy ExtendScript engine or use a different obfuscation method that is compatible with ECMAScript 2018. Some obfuscation methods might not be compatible with both expression engines."
Quote: Adobe
Howto:
- 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
@JSXBIN@ES@2.0@MyBbyBn0ABJAnAEjzGjXjJjHjHjMjFBfRCFdCFdUff0DzACByB
- 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.
eval("@JSXBIN@ES@2.0@MyBbyBn0ABJAnAEjzGjXjJjHjHjMjFBfRCFdCFdUff0DzACByB");
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.
Example:
var x = 20;
// code to compile
wiggle(2,x);
//
The compiled version would be
var x = 20;
eval("@JSXBIN@ES@2.0@MyBbyBn0ABJAnAEjzGjXjJjHjHjMjFBfRCFdCjzBjYCfff0DzADByB");
Blog