-
for loop (opacity)
Hey Guys,
I’m not having much luck with this one. for loops have always been my weakest area from day one.
val = 0;
for( i=1; i <= thisComp.numLayers; i++){
if (i == index) continue;
L = thisComp.layer(i)
if(L.transform.opacity == 0) continue;
if(L.transform.opacity == 100){
val = L.transform.position[1] + 40;
break;
}
}
[value[0],val]I’m trying to do an opacity expression that loops. If the item’s opacity is 0 it will look at the next one and position itself accordingly (Either this way or if it’s active, I don’t mind)
But it kind of works, but not quite exactly the way I want it to.
Essentially I two grids with 8 layers (9 if you include the header), not all layers need to be active (Or opacity 100). So if there is less than as soon as there is space (Inactive), everything moves itself up one.
Example below
Title
Layer1
Layer2
Layer3
Title
Layer1
Layer2
Layer3Title
Layer1
Layer2
Title
Layer1
Layer2
Layer3