Search code examples
adobeextendscriptafter-effects

How to know property names and apis to add effects to layers on After Effects?


I am really having a hard time looking for information about how to use the scripting language (called extendedscript but it its javascript) in Adobe After Effects.

I find pages like this ones:

  1. https://www.aenhancers.com/
  2. https://github.com/fabianmoronzirfas
  3. http://docs.aenhancers.com/
  4. https://blogs.adobe.com/creativecloud/files/2012/06/After-Effects-CS6-Scripting-Guide.pdf

But they lack examples of very simple things. Especially the scripting guide! What I'd like to know is how to find a way to detect the proper "naming" of properties to know how to assing them.

I. E. I would like to create a key frame without blur on a text layer in second 5, and with blur in second 10. It looks like something simple... it should be like this:

var myProject = app.project;
var myComposition = myProject.activeItem;
var myTextLayer = myComposition.layers.addText("new_text_layer");
myTextLayer.addProperty("blur").setValueAtTime(5, 0);
myTextLayer.addProperty("blur").setValueAtTime(10, 60);

However, I cannot find the proper literal name to add effects, I don't know how to add property "blur" cause I don't know the word the scripting language uses for "blurring"!!! That's the same for almost everything.

So... How can I find out how to programatically set properties to layers on After Effects?

Thank you.


Solution

  • Effects are properties of layers and can be accessed as specified here. To access an effect you need to know the effect's name. You can then use

    var effect1 = app.project.item(1).layer(1).effect("effect name")("effect param name");
    

    Since there is no limit on how many effects are available for AE (e.g. there are at least half a dozen blur effects, but no effect called just "blur"), the individual effects are not built-in to the extendscript language, so you need to know how to specify each one. The Extendscript Toolkit's data browser is useful for this, because you can have a live instance of AE going and look through the data structures.

    Another useful tool is the redefinery's rd:scripts package. It contains 51 really useful scripts for developers and it's free. One in particular is the gimme prop path script that will tell you the full path for a selected property.