简化if/else表达式



我如何简化这个After Effects表达式,所以我不单独列出每个滑块?怎么把它写成1到5之间的数组呢?我真的很感激你能提供的任何帮助。

targetLayer = effect("Layer Source For Grid")("Layer");
check = targetLayer.effect("Enable First ROW Control")("Checkbox");
fAj01 = thisComp.layer("BOX").effect("COLUMN control 1")("Slider");// 1st column
fAj02 = thisComp.layer("BOX").effect("COLUMN control 2")("Slider");// 2st column
fAj03 = thisComp.layer("BOX").effect("COLUMN control 3")("Slider");// 3st column
fAj04 = thisComp.layer("BOX").effect("COLUMN control 4")("Slider");// 4st column
fAj05 = thisComp.layer("BOX").effect("COLUMN control 5")("Slider");// 5st column
if(check == 0 && fAj01 == 0 && fAj02 == 0 && fAj03 == 0 && fAj04 == 0 && fAj05 == 0) {
100;
} else {
0;
}
targetLayer = effect("Layer Source For Grid")("Layer");
const numbers= = Array(5)
const check = targetLayer.effect("Enable First ROW Control")("Checkbox");
const sliders = numbers.map(num => thisComp.layer("BOX").effect("COLUMN control " + (num + 1))("Slider"))
if(check == 0 && sliders.every(slider => slider == 0)) {
100;
} else {
0;
}

不能100%确定map.every与AE中的表达式一起工作。这里有一个使用更基本的语法

const targetLayer = effect("Layer Source For Grid")("Layer");
if (targetLayer.effect("Enable First ROW Control")("Checkbox")){
for (let i = 1; i <= 5; i++){
if (thisComp.layer("BOX").effect("COLUMN control " + i)("Slider").value !== 0){
return 0
};
}
}
100;

相关内容

  • 没有找到相关文章

最新更新