Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change value on particular keyframe with expression

  • Change value on particular keyframe with expression

    Posted by Hannes Paulsson on October 23, 2013 at 8:33 pm

    Hi!

    I’m doing a project where I need to have a few different settings set by a bunch of expression controls on a null.
    The thing is that a different people are supposed to be able to open up the project, change the parameters and then just hit render.

    Everything is working out fine, except one thing. I have one element that is kind of like a speedometer. I want anyone to be able to set a max number for how far the meter goes, but it should always start at zero.

    The way i imagine i would do this is to set two keyframes, one at zero and one that I want to be controlled by the slider.

    The animation then uses a wiggle (set by a different slider that they don’t see), that adds a bit of wiggle between the two keyframes.

    So, is there a way to set just one of the keyframes to be linked to a slider?

    Or could I perhaps make a value that starts at 0 at a given time, and then animates to the a adjustable value during a set time?

    Thanks,
    Hannes

    Mohimanul Howladar replied 8 years ago 3 Members · 3 Replies
  • 3 Replies
  • Kevin Camp

    October 24, 2013 at 12:01 am

    you can use the timing of the keys and interpolate new values using ease() or linear() functions, so something like this may work for you.

    max = thisComp.layer("Null 1").effect("Slider Control")("Slider");
    min = 0;
    w = wiggle(5,5);
    t1 = key(1).time;
    t2 = key(2).time
    if (time<=t1) min;
    else if (time>t1 && time<t2) ease(time,t1,t2,min,max) + w;
    else max;

    obviously change the ‘Null 1’ layer to your control null name and you can change the w value to your wiggle values and link it to your slider.

    since the expression adds wiggle(), you’ll want to set the actual values for both key frames to 0.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Hannes Paulsson

    October 24, 2013 at 7:11 pm

    Thanks! This works perfectly!

  • Mohimanul Howladar

    April 26, 2018 at 9:59 am

    Works but i have get this type extend number and ti’s not work with Math.round(),
    How can i make if round figer

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