Skip to main content
April 1, 2012
Answered

setting multiple attributes for an effect in one go???

  • April 1, 2012
  • 1 reply
  • 1094 views

Hi,

i am adding drop shadows to a layer and i wanted to set the distance, opacity and softness in an efficient way. Is it possible to do this on one line?

so far my code is like this, i have only set the distance here:

var comp = app.project.activeItem;

comp.layer(1).property("Effects").addProperty("Drop Shadow").Distance.setValue(15);

any thoughts??

thanks,

Sam

This topic has been closed for replies.
Correct answer Dan Ebberts

oh no, actually this just creates 3 drop shadows, rather than tweaking the specified attribute for each. What is the line for accessing the drop shadows opacity, i cant seem to get it to work:

layer.property("Effects").property("Drop Shadow").property("Opacity").setValue(25);

obviously the middle part of this is wrong. cant figure out what it needs to be


I'm not sure why you would get multiple drop shadows (I don't) but there is something strange going on. It turns out that to get an opacity value of 25%, you actually have to do setValue(63.75). Whatever value you want, multiply it by 2.55 before you do the setValue().

Dan

1 reply

Dan Ebberts
Community Expert
Community Expert
April 1, 2012

Unless you have the script apply a preset with your effect and parameter settings, this is probably the best I could come up with:

var comp = app.project.activeItem;

var myEffect = comp.layer(1).property("Effects").addProperty("Drop Shadow");

myEffect.property("Distance").setValue(15);

myEffect.property("Opacity").setValue(25);

myEffect.property("Softness").setValue(10);

Dan

April 1, 2012

dans on fire!

April 3, 2012

oh no, actually this just creates 3 drop shadows, rather than tweaking the specified attribute for each. What is the line for accessing the drop shadows opacity, i cant seem to get it to work:

layer.property("Effects").property("Drop Shadow").property("Opacity").setValue(25);

obviously the middle part of this is wrong. cant figure out what it needs to be