Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Path keyframes to Expression slider control

  • Path keyframes to Expression slider control

    Posted by Patrick Murphy on May 8, 2015 at 7:55 pm

    Hi,

    I’m trying to link a set of path keyframes to an expression slider on a null layer.

    Basically I have an eye shape layer. Keyframes on the path so it’s open, closed, etc.

    I’d like to just use the slider on the null layer to control the eye (anywhere in the timeline)

    Hope this makes sense, I saw a post about linking opacity keyframes but not sure how to link path keyframes to a slider.

    Thanks for any help/suggestions!!

    Patrick Murphy replied 11 years ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    May 8, 2015 at 8:30 pm

    I’m not sure if this is exactly what you’re after, but it might give you some ideas. Apply an expression like this to your path, then as you move the slider from 0 to 100, your path will animate from its first to last keyframes.


    s = thisComp.layer("Null 1").effect("Slider Control")("Slider");
    if (numKeys > 1){
    t0 = key(1).time;
    t1 = key(numKeys).time;
    t = linear(s,0,100,t0,t1);
    valueAtTime(t);
    }else
    value

    Dan

  • Patrick Murphy

    May 8, 2015 at 8:58 pm

    That works Dan, not how I was thinking but it works.

    Right now it morphs between the keyframes, which is very nice and could have other applications.

    I was thinking the slider would just step through each keyframe from the layer.

    Currently the slider values to reach each keyframe (there are 4 keyframes at the moment) are 0, 34, 64, 106. In this instance, It’d be cool if the slider just had the numbers 1, 2, 3, 4… to select the keyframes 1, 2, 3, 4… Just so it’s easier to use and if someone else has to use the rig.

    But, I know beggars can’t be choosers!

    Thanks a bunch Dan, I really appreciate the quick help!

  • Dan Ebberts

    May 8, 2015 at 9:28 pm

    This version rounds the slider value to the nearest whole number and clamps the value between 1 and the number of keyframes. So the 1st keyframe is selected for slider values between 0 and 1.5, 2nd keyframe is selected for slider values between 1.5 and 2.5, etc.

    n = Math.round(thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”));
    n = clamp(n,1,numKeys)
    valueAtTime(key(n).time);

    Dan

  • Patrick Murphy

    May 8, 2015 at 9:35 pm

    Magic! Thanks for making my animation a little easier! I really appreciate it.

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