set variable via index
Posted: November 11th, 2007, 12:37 pm
Hi. I have a bunch of layers with the "circle"-effect applied on it. I have a "control"-layer with 4 defined colors. The aim is:
Layer1: color1
Layer2: color2
Layer3: color3
Layer4: color4
Layer5: color1
Layer6: color2
...(and so on)
This is my lousy try, but it doesn't work:
(applied on the color option of the circle effect)
var a = ('1','5',...);
var b = ('2','6',...);
var c = ('3','7',...);
var d = ('4','8',...);
if (thisLayer.index=a){
thisComp.layer("control").effect("color1")("color")
}
else if (thisLayer.index=b){
thisComp.layer("control").effect("color2")("color")
}
else if (thisLayer.index=c){
thisComp.layer("control").effect("color2")("color")
}
else{
thisComp.layer("control").effect("color4")("color")
}
I am looking for an expression that works for every layer, independently from the number of layers or colors.
Layer1: color1
Layer2: color2
Layer3: color3
Layer4: color4
Layer5: color1
Layer6: color2
...(and so on)
This is my lousy try, but it doesn't work:
(applied on the color option of the circle effect)
var a = ('1','5',...);
var b = ('2','6',...);
var c = ('3','7',...);
var d = ('4','8',...);
if (thisLayer.index=a){
thisComp.layer("control").effect("color1")("color")
}
else if (thisLayer.index=b){
thisComp.layer("control").effect("color2")("color")
}
else if (thisLayer.index=c){
thisComp.layer("control").effect("color2")("color")
}
else{
thisComp.layer("control").effect("color4")("color")
}
I am looking for an expression that works for every layer, independently from the number of layers or colors.