0

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 > 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

1 Answer 1

0

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 && time < t2){
    y =linear(time,t1,t2,v2,v2);
}

if (headOutro==false && time > 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.

1
  • Oh wow, that was simpler than I thought. Thank you stib!
    – Steffen
    Commented Aug 13, 2019 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.