passiflora
passiflora

Reputation: 352

Adding effects by scripting in After Effects

Here I want to write a script that can stabilize the time lapse sequence by adding Warp Stabilizer VFX, then followed by deflicker using DEFlicker Time Lapse, and finally render and export the video, which runs before sleeping so that it does not slow down my computer at working time. However, I cannot find the API that adds effects to a layer in AE scripting documentation, does anyone knows how to do this? thanks in advance!

Upvotes: 0

Views: 1181

Answers (1)

Iaroslav Kovaliuk
Iaroslav Kovaliuk

Reputation: 26

You can add effects to the layers like this:

if (!theLayer.Effects.property("Warp Stabilizer")){   //add only if no such effect applied
    var theEffect = theLayer.property("Effects").addProperty("Warp Stabilizer");  // the regular way to add an effect
}

To test it you can add it to selected layer, full code to apply it to the selected layer can look like this:

var activeItem = app.project.activeItem;

if (activeItem != null && activeItem instanceof CompItem) {          // only proceeds if one comp is active

  if (activeItem.selectedLayers.length == 1) {          // only proceeds if one layer is selected

    var theLayer = activeItem.selectedLayers[0];
if (!theLayer.Effects.property("Warp Stabilizer")){
    var theEffect = theLayer.property("Effects").addProperty("Warp Stabilizer");          // the regular way to add an effect
  }
 }
}

Solution is based on adobe forum: https://forums.adobe.com/thread/1204115

Upvotes: 1

Related Questions