ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Interpolating between keyframes with a slider.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Anders Hattne
Interpolating between keyframes with a slider.
on Mar 22, 2015 at 10:43:18 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.


Return to posts index

Dan Ebberts
Re: Interpolating between keyframes with a slider.
on Mar 22, 2015 at 11:45:52 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){
}else if (n == s.numKeys){
}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));


Return to posts index

Anders Hattne
Re: Interpolating between keyframes with a slider.
on Mar 23, 2015 at 12:03:38 pm


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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved