-
Is there a better way? (if else stuff)
Good day my beautiful friends,
I’m using this expression to essentially up the value of a slider, as soon as a certain layer’s x Scale goes higher than 0.
I’m keen to see if there’s a more simple, and safer way of writing, or approaching this? In a perfect world I wouldn’t have to add an additional statement if I wanted to check more than 4 layers.
Thank you in advance for your help!
var v = 0;
f = framesToTime(3);
offset = time+f;var L1 = thisComp.layer(“L1”).transform.scale.valueAtTime(offset)[0];
var L2 = thisComp.layer(“L2”).transform.scale.valueAtTime(offset)[0];
var L3 = thisComp.layer(“L3”).transform.scale.valueAtTime(offset)[0];
var L4 = 0;if (L1>0 && L2 == 0) {v = 1
}else if (L2>0 && L3 == 0) {v = 2
}else if (L3>0 && L4 == 0) {v=3
}
else v=1;