Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Interpolating between keyframes with a slider.

  • Interpolating between keyframes with a slider.

    Posted by Anders Hattne on March 22, 2015 at 10:43 pm

    I’m trying to do some lipsyncing and am using the bezierwarp to create shapes for the lips.
    So I have keyframed some poses with bezierwarp for vowels but having to copy 36 keys on three layers per mouth shape is going to be a bit cumbersome so.. So using a slider to interpolate between the poses would be nice. (Slider value 1 represents an A, 2: E, 3: I etc(

    I thought I’ll just write:
    shape = tied to a slider followed by
    effect(“Bezier Warp”)(“Top Left Vertex”).key(shape) for each vertex point.

    That just makes the mouth jump from one shape to the other, and I’d like it to interpolate.
    I figure I’ll have to know the value of the current key of the slider, and the next value and the time needed to do the interpolation, but getting that data is beyond me.

    I hope that is understandable and if there is a way of doing this.

    Thanks,
    Anders

    http://www.ardillamedia.com

    Anders Hattne replied 11 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    March 22, 2015 at 11:45 pm

    I wasn’t clear to me how you have the shape keyframes set up, but if the slider value corresponds to the frame number of the Bezier Warp shape, something like this should work:


    s = thisComp.layer("control").effect("Slider Control")("Slider");
    n = 0;
    if (s.numKeys > 0){
    n = s.nearestKey(time).index;
    if (s.key(n).time > time) n--;
    }
    if (n == 0){
    valueAtTime(framesToTime(s.key(1).value));
    }else if (n == s.numKeys){
    valueAtTime(framesToTime(s.key(s.numKeys).value));
    }if (n > 0 && n < s.numKeys){
    t1 = s.key(n).time;
    t2 = s.key(n+1).time;
    v1 = valueAtTime(framesToTime(s.key(n).value));
    v2 = valueAtTime(framesToTime(s.key(n+1).value));
    linear(time,t1,t2,v1,v2);
    }

    Dan

  • Anders Hattne

    March 23, 2015 at 12:03 pm

    Amazing!!

    I have a hard time understanging the “nearestKey” function but I guess I can figure out why this works.

    Brilliant!

    http://www.ardillamedia.com

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