How to apply expression using script?
I'm using a script and an expression to automate all selected layer to follow the control layer. So, I do it on two step right now, first make a control layer using this script:
{
var comp = app.project.activeItem;
var slctd_layer = comp.selectedLayers;
var new_adjustment = comp.layers.addSolid([1,1,1], "Controler", comp.width,comp.height,comp.pixelAspect,comp.duration);
new_adjustment.adjustmentLayer = true;
var addSlider1 = app.project.activeItem.selectedLayers[0].Effects.addProperty("ADBE Slider Control");
addSlider1.name = "delay";
addSlider1.property(1).setValueAtTime(0, 0.06);
var addSlider2 = app.project.activeItem.selectedLayers[0].Effects.addProperty("ADBE Slider Control");
addSlider2.name = "opacity";
addSlider2.property(1).setValueAtTime(2, 0);
addSlider2.property(1).setValueAtTime(2.03, 100);
}
Then I select all layer below the controler and apply the expression, for example:
delay = thisComp.layer("Controler").effect("delay")("Slider")*index;
t = time+delay;
exp = thisComp.layer("Controler").effect("opacity")("Slider").valueAtTime(t);
exp;
I'm working on a tight schedule animation and tons of material with tons of layer for each comp right now. So, I'm just thinking if it's possible to combine this two step into one script that will automate this work for me. I'm still new on scripting and need any help with it. Thanks
