Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control scale keyframes with slider

  • Control scale keyframes with slider

    Posted by Ryan Hagen on December 5, 2017 at 6:28 pm

    This is the expression i’m using, and it’s not working currently. I have 4 keyframes total, and i’m unsure if I needed to add that in the expression as well(unsure how or where).
    To further clarify, I have a box, animated on it’s X, it animates on, holds for a certain period of time, and then animates back to zero. I want to give the end user the ability to change the box’s scale with the slider. So if the scale is 100, if they set it to 20 on the slider, it would be 120, without having to adjust the keyframes. I hope that makes sense. Thanks for any help.

    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(2).time;
    v1 = 0;
    v2 = value + thisComp.layer("Info_box_ct").effect("infoBox_length")("Slider")
    linear(time,t1,t2,v1,v2);
    }else
    value

    Wisnu Wibowo replied 8 years, 8 months ago 3 Members · 3 Replies
  • 3 Replies
  • Andrei Popa

    December 6, 2017 at 9:05 am

    The way i understand it is . You have a box, animate its x scale 0->100, hold at 100, then 100->0 and would like your 100 to be controllable. In this case i think this would work.x=value[0]*effect("Slider Control")("Slider")/100;
    [x,value[1]]
    You must adjust the “effect(“Slider Control”)(“Slider”)” to your slider by pickwhiping to it.

    Andrei
    My Envato portfolio.

  • Ryan Hagen

    December 6, 2017 at 2:11 pm

    Thank you Andrei, that worked well enough, I just need to make sure the slider is set to 100 and it works like a charm. Thank you for your help!!!

  • Wisnu Wibowo

    December 25, 2017 at 4:21 pm

    I have 2 keyframes, I want to change the scale with the slider control at 2nd keyframe and add inertial bounce expression.
    I tried this expression but the inertial bounce doesn’t work, inertial bounce will work if I put “temp = value[0]*effect(“Slider Control”)(“Slider”)/100; [temp, temp]” on the top but the slider controller doesn’t work.
    Please help me.
    Thanks.

    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time - key(n).time;
    }

    if (n > 0 && t < 1){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 8.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    }

    temp = value[0]*effect("Slider Control")("Slider")/100;
    [temp, temp]

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