How to alternate between two states using expressions
//Alternate between two states for any given duration respective of the inputs. This requires two inputs; preferably slider controllers, called "Time A" and "Time B" on a layer called "Control".
t = time;
a = thisComp.layer("Control").effect("Time A")("Slider");
b = thisComp.layer("Control").effect("Time B")("Slider");
y = b/a + 1; //fancy math so the slider numbers match the time in seconds.
z = a * y;
if(t % z < a)
"state 1";
else
"state 2";
