Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Controlling the value AND the timing of a specific keyframe

  • Controlling the value AND the timing of a specific keyframe

    Posted by Thibault Millienne on November 26, 2020 at 3:09 pm

    Hi,

    I’m just facing a problem with expression. I’m not good with it, and most of the time I’m searching on the web what I need to copy/paste to get my automation done.

    I have two keyframes of position and I want to control the timing and the value of the second keyframe with sliders.

    I got this to control the timing :

    dur = thisComp.layer(“CONTROL SCRIPT”).effect(“Slider Control”)(“Slider”);
    if (time < key(1).time){
    value;
    }else if (time < (key(1).time + dur)){
    t = time – key(1).time;
    d = key(2).time – key(1).time;
    valueAtTime(key(1).time + d*t/dur);
    }else{
    t = time – (key(1).time + dur);
    valueAtTime(key(2).time + t);
    }

    and I got this to control the value :

    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(2).time;
    v1 = [964,598];
    v2 = thisComp.layer(“CONTROL SCRIPT”).effect(“Point Control”)(“Point”);
    linear(time,t1,t2,v1,v2);
    }else
    value

    Each one work well separetly, but how can I blend them together ?

    Thanks for your help !

    Thibault

    Dan Ebberts replied 5 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    November 26, 2020 at 9:58 pm

    Probably something like this:

    L = thisComp.layer("CONTROL SCRIPT");

    dur = L.effect("Slider Control")("Slider");

    point = L.effect("Point Control")("Point");

    if (numKeys > 1){

    t1 = key(1).time;

    t2 = t1 + dur;

    v1 = key(1).value;

    v2 = L.toComp(point);

    linear(time,t1,t2,v1,v2);

    }else

    value

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy