Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions add drop shadow to layer

  • add drop shadow to layer

    Posted by Lars Pedersen on December 15, 2013 at 3:52 pm

    Trying to create a script thats gonna add a layer with a dropshadow to the 3th layer in every comp in my project for automation but i dont get it.

    var myComp = app.project.activeItem;
    var backgroundLayer = currentComp.layers.addSolid([93, 5, 2], “Background”);

    backgroundLayer.Effects.addProperty(“Drop Shadow”);
    backgroundLayer.property(“Effects”).property(“Drop Shadow”).property(“Softness”).setValue([28]);

    get the error null is not an object…

    Dan Ebberts
    replied 12 years, 4 months ago
    3 Members · 3 Replies
  • 3 Replies
  • Xavier Gomez

    December 15, 2013 at 5:46 pm

    currentComp is not defined.

  • Lars Pedersen

    December 15, 2013 at 6:00 pm

    renamed currentComp to mycomp but now it only works on 1 selected comp and not multiple comps. Do i need a for/while command of some kind??

  • Dan Ebberts

    December 15, 2013 at 6:33 pm

    Yes, yo’ll need a loop to do that:


    for (var i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i) instanceof CompItem){
    var myComp = app.project.item(i);
    var backgroundLayer = myComp.layers.addSolid([93, 5, 2], "Background", 100, 100 ,1, myComp.duration);
    backgroundLayer.Effects.addProperty("Drop Shadow");
    backgroundLayer.property("Effects").property("Drop Shadow").property("Softness").setValue([28]);
    }
    }

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy