AE Keyframe Control through checkboxes I have a position animation with four keyframes, two for a intro, two for a outro. Also I have a Master where you have two checkboxes "Intro" and "Outro". 
The idea is to override the keyframe values so that there won't be any intro animation when the checkbox for it isn't checked (same for outro). 
Sadly I only can override all values, so when I uncheck one of the checkboxes, there is no animation anymore. How can I change only the value inbetween the keyframes I need?

var x=thisProperty[0]; 
var y=thisProperty[1];
var headIntro=thisComp.layer("MASTER").effect("HEADLINE | Intro")(1);  
var headOutro=thisComp.layer("MASTER").effect("HEADLINE | Outro")(1);  

if (numKeys &gt; 3){

    var t1 = key(1).time;
    var t2 = key(2).time;
    var t3 = key(3).time;
    var t4 = key(4).time;

    var v1 = key(1).value[1];
    var v2 = key(2).value[1];
    var v3 = key(3).value[1];
    var v4 = key(4).value[1];


    if (headIntro==false){
        y =linear(time,t1,t2,v2,v2);
    }

    if (headOutro==false){
        y =linear(time,t3,t4,v3,v3);
    }  
}
[x,y]


Thanks for the help
If you look at the part where you have 


if (headIntro==false){
    y =linear(time,t1,t2,v2,v2); //this is calculated first
}

if (headOutro==false){
    y =linear(time,t3,t4,v3,v3); //this is calculated next, overwriting previous value
}  


when headOutro == false is true, the value for y will be calculated using the value returned by the second linear expression, so no matter what it was previously calculated to be it will always return y = linear(time, t3,t4,v3,v3);.

change it to

if (headIntro==false &amp;&amp; time &lt; t2){
    y =linear(time,t1,t2,v2,v2);
}

if (headOutro==false &amp;&amp; time &gt; t3){
    y =linear(time,t3,t4,v3,v3);
}  


so now the linear expressions will only be calculated when the time is in the intro or outro sections respectively.