ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

ExtendScript function question

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Huntington Carpenter
ExtendScript function question
on Jan 7, 2020 at 12:50:18 am

Hey all just a quick question to try and get some help. I have a function running to duplicate a layer in extendscript. It dupes the layer and adds a number on the end sequentially which is perfect. The part that is stumping me is I then need it to also add that number sequentially to the expression that is on that layer. I know that it is reading the expression correctly because I get it on every dupe it just doesn't add the number to the expression. Any help appreciated, having a rough time learning this.
exa below
----------------------------
var comp = newComp2;
var layer = comp.layer("LINE ");
var yPos = layer.property("ADBE Transform Group").property("ADBE Position_1");
var exp = yPos.expression = "test ";

createLines(comp, layer, parseInt(titleEditText.text), yPos, parseInt(titleEditText.text));
newComp2.layer("LINE ").remove();

function createLines(comp, layer, lines, yPos, exp){
var dLayer;
for(var i = 1; i <= lines; i++){
dLayer = layer.duplicate();
dLayer.name = "LINE "+i.toString();

}

}


Return to posts index

Huntington Carpenter
Re: ExtendScript function question
on Jan 7, 2020 at 3:54:39 am

I figured it out if anyone was curious ☺

var comp = newComp2;
var layer = comp.layer("LINE ");
var yPos = layer.property("ADBE Transform Group").property("ADBE Position_1");
var exp = yPos.expression = """thisComp.layer("line control").effect("Slider Control")("Slider")+thisComp.layer("minor adjustment").effect("Slider Control")("Slider")-1+""";

createLines(comp, layer, parseInt(titleEditText.text), yPos, parseInt(titleEditText.text));
newComp2.layer("LINE ").remove();

function createLines(comp, layer, lines, yPos, exp){
var dLayer;
for(var i = 1; i <= lines; i++){
exp = yPos.expression = """thisComp.layer("line control").effect("Slider Control")("Slider")+thisComp.layer("minor adjustment").effect("Slider Control")("Slider")-1+"""+i.toString();
dLayer = layer.duplicate();
dLayer.name = "LINE "+i.toString();

}

}

}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]