ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Use expression to 'tween' Shape object (path).

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Levi George
Use expression to 'tween' Shape object (path).
on Jun 11, 2013 at 7:15:11 am

Hi Creative Cow

Thanks for taking the time to help me. I'm developing a lip-sync system in After Effects and I'm trying to set a specific mouth shape to occur at specific times determined by another Null Object. Basically this Null Object (called Mouth_Control) has a slider for each desired Mouth shape with a value between 1 an 0. 1 Being 'on' and 0 being 'off'. There are 10 sliders.

I have then created a shape value which I would like to blend from shape to shape at the appropriate times. for example:

if (at frame 10 Mouth_Control.SliderAI = 1){this path = valueAtTime.AI Shape}

Obviously that isn't the exact code. But hopefully it'll give you an idea what I am doing.

Everything works perfectly. Except I can't get the mouth shapes to blend (or tween) into each other. I can only allow it to snap from one shape to the next instead of letting it gently merge from one shape into another the way it does when you set keyframes and move the verticies in the shape by hand.

For example:

At Frame 9 the shape is the AI Mouth shape, (where AI on the null slider=1)

At Frame 12 the shape is the E Mouth shape, (where AI on the null slider=0 & E on the null slider=1)

However on frame 10 I would like the shape to be 33% AI and 66% E
On frame 11 I would like the shape to be 66% AI and 33% E
before finally becoming 100% E on Frame 12.

I don't know if this is even possible. I tried multiplying the shape by the NULL Object Value. At the end of the day, my ignorance of which expressions can be used on shapes is what is holding me back. I have placed the code below, any help would be greatly appreciated.

// variables determine the location of each mouth shape slider.

AI = comp("NateRig").layer("Mouth_Control").effect("AI")("Slider") ;
E = comp("NateRig").layer("Mouth_Control").effect("E")("Slider") ;
etc = comp("NateRig").layer("Mouth_Control").effect("etc")("Slider") ;
FV = comp("NateRig").layer("Mouth_Control").effect("FV")("Slider") ;
L = comp("NateRig").layer("Mouth_Control").effect("L")("Slider") ;
MBP = comp("NateRig").layer("Mouth_Control").effect("MBP")("Slider") ;
O = comp("NateRig").layer("Mouth_Control").effect("O")("Slider") ;
rest = comp("NateRig").layer("Mouth_Control").effect("rest")("Slider") ;
U = comp("NateRig").layer("Mouth_Control").effect("U")("Slider") ;
WQ = comp("NateRig").layer("Mouth_Control").effect("WQ")("Slider") ;

if(AI.valueAtTime(time)>0){value = valueAtTime(framesToTime(0))}
else if(E.valueAtTime(time)>0){value = valueAtTime(framesToTime(1))}
else if(etc.valueAtTime(time)>0){value = valueAtTime(framesToTime(2))}
else if(FV.valueAtTime(time)>0){value = valueAtTime(framesToTime(3))}
else if(L.valueAtTime(time)>0){value = valueAtTime(framesToTime(4))}
else if(MBP.valueAtTime(time)>0){value = valueAtTime(framesToTime(5))}
else if(O.valueAtTime(time)>0){value = valueAtTime(framesToTime(6))}
else if(rest.valueAtTime(time)>0){value = valueAtTime(framesToTime(7))}
else if(U.valueAtTime(time)>0){value = valueAtTime(framesToTime(8))}
else if(WQ.valueAtTime(time)>0){value = valueAtTime(framesToTime(9))}

else{
value = valueAtTime(framesToTime(1))
}


Return to posts index

Dan Ebberts
Re: Use expression to 'tween' Shape object (path).
on Jun 11, 2013 at 1:57:47 pm

Unfortunately, with expressions and paths, valueAtTime() is about the only tool you have to work with. You can't do any math or tweening on them. I think the best you could do would be to create a post-processing script that could create in-between keyframes for you after you have everything set up.


Dan



Return to posts index

Xavier Gomez
Re: Use expression to 'tween' Shape object (path).
on Jun 12, 2013 at 11:30:13 am

Hello,
it is an interesting problem, but i have several questions.

It looks like all your sliders can only take values 0/1 and only one slider can have value 1 at a given time. So it might be a lot easier to have only one slider taking integral values from 1 to 10. It makes the sorting much easier (and faster).
And also, are you using shape paths or mask paths ?

I've just written a script that sorts this for mask paths, it's working pretty well, but it's maybe not the right setting for you.

Xavier


Return to posts index


Levi George
Re: Use expression to 'tween' Shape object (path).
on Jun 21, 2013 at 12:35:34 am

Thanks for your help everyone. Yeah so it seems like what I want to do is impossible without using scripts. Xavier Gomez, thank you for your suggestion to use one slider. Because the mouth has to side from one position into another I don't think it would work for my intended purpose.

I did find another way to solve the problem.

I made a shape using pins and uses the sliders to control the position of them. Each pin has a different x and y position for each mouth shape. It works fine although it's pumped the render time up a little.

Thanks again.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]