Adobe After Effects Forum
Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 8, 2019 at 4:46:19 pm

Hi everyone!

I'm making a complex Mouth Rig using Sliders in Joysticks and Sliders. I now have 6 sliders which all give me a different mouth shape. Now I made keyframes on all 6 layers where each Slider at 100% gives a Mouth Shape, when the other Sliders are at 0%. I now want to make a pose to pose way of animating where I use one slider that refers to this combination of keyframes giving me a specific mouth position. I have seen tutorials on internet doing pose to pose, but in the cases I have seen it always has to Pass by other mouth shapes. I want to make direct movements from every mouth shape to another mouth shape.

The thing I had in mind was linking this set of keyframes to a MASTER SLIDER, where value 1 gives me the combination of keyframes referring to for example: Slider 1 of the "ALL-MOUTH-SLIDERS-COMP".

Or another way (which I didn't figure out yet) is to refer to the frame where is the combination of these 6 Sliders with ValueAtTime and make the MASTER layer link to this.

Any suggestions?

I am aware that the easy way is just to copy paste the 6 keyframes, but I like it to be more organised.


example:

Slider1: 100%,0%,0%,0%,0%,0% (open mouth)
Slider2: 0%,100%,0%,0%,0%,0% (closed mouth)
etc.




Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 8, 2019 at 4:47:10 pm

The way I did it now (if, else), there is no animation between the keyframes.... And I want to have a morph between the shapes. Not just "different images".


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Filip Vandueren on May 8, 2019 at 9:22:18 pm

Can you make a joystick and slider to control your different joystick and sliders ?




Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 8, 2019 at 9:57:08 pm

As it seems to me Joysticks and Sliders always gives for each 'frame' one slider. So it will give me 6 sliders again.


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Walter Soyka on May 9, 2019 at 9:20:07 am

A lot of Ae rigs like this use time-remapping to let you choose a particular frame from a comp. When you animate a controlling slider from the pose in frame 1 to the pose in frame 3, it passes by the pose in frame 2.

To have the mouth shape interpolate between two arbitrary mouth shapes, you have two options that I see:

1) Build your mouth shape such that every pose of the mouth can be created by adjusting the same set of properties. Then we can use valueAtTime to get the value of each property at the outgoing and incoming pose, and have Ae interpolate between them. You'll have to use the new Master Properties features and some expressions to "push" the pose value into the rigged comp.

2) Animate all 30 transitions by hand (1-2, 1-3, 1-4, 1-5, 1-6, 2-1, 2-3, etc.) on the same timeline and use time-remapping expressions to "pull" the correct sequence from the rigged comp.

Can you share the rigged mouth shape comp you've built?

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 9, 2019 at 12:30:24 pm

Hi Walter,

I was as a matter of fact experimenting with ValueAtTime, but still it only gives me the 'exact' value (1 frame) and I am not able to make an animation between the values controlled by one Slider. This specific Slider I have called "control".

I pasted the following code in each of the 6 sliders:

x = thisComp.layer("control").effect("Slider Control")("Slider")

if ((x>=1) && (x<2)) {[valueAtTime(framesToTime(0))];} else
if ((x>=2) && (x<3)) {[valueAtTime(framesToTime(3))];} else
if ((x>=3) && (x<4)) {[valueAtTime(framesToTime(6))];} else
if ((x>=4) && (x<5)) {[valueAtTime(framesToTime(9))];} else
if ((x>=5) && (x<6)) {[valueAtTime(framesToTime(12))];} else
if ((x>=6) && (x<7)) {[valueAtTime(framesToTime(15))];} else 0



I attached the RIG in this post.

13327_mouthrig.zip


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Filip Vandueren on May 9, 2019 at 1:24:25 pm

Then what happens if you animate your slider from 5 to 1: do you want it to pass through setting s 5,4,3,2,1 (similar to the behaviour that Walter described for Time-remapping) or do you want it to tween between the settings of 5 and 1.
The latter can not be achieved by just 1 slider (unless you use hold-keyframes,n which defies the purpose 😉 )

you would need 3 sliders:
fromPose
toPose
amount.
and animating these 3 needs its own housekeeping, because fromPose and toPose should use hold keyframes and not change in the middle of when you're animating slider 3.

Then ach of your original 6 sliders would need something like

[this is pseudo-code, won't work yet)
a=valueAtTime(fromPose);
b=valueAtTime(toPose);
linear(amountSlider,0,100,a,b);




Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 9, 2019 at 3:03:07 pm

Thanks Filip. So I would need 3 sliders. It makes sense what you are telling me! Thanks for this. But I suppose 3 sliders doesn't give me de 'fewer housekeeping' that I was looking for. If this is the only solution, I suppose I have to stick to keyframing 6 sliders.

I was hoping for a very nice and fancy way using only one slider. Would it according to you be possible like this -->

Slider value goes from 1-10

1 till 2 is the same as 100, 0, 0, 0, 0, 0 to 0, 100, 0, 0, 0, 0, 0

It seems like it should to me. On the other hand all my tries gave me only absolute frames and no in betweens. Shouldn't it be possible to create something like this with the linear expression that you are using as well?


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 9, 2019 at 3:04:54 pm

Walter:

1) Build your mouth shape such that every pose of the mouth can be created by adjusting the same set of properties. Then we can use valueAtTime to get the value of each property at the outgoing and incoming pose, and have Ae interpolate between them. You'll have to use the new Master Properties features and some expressions to "push" the pose value into the rigged comp.

This solution seems very close as well, but I'm not sure what the New Master Properties give me for options to make this. I would be grateful if someone could maybe elaborate this solution more. It seems to be the thing I almost had, except this will probably give the in-betweens as well.


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 9, 2019 at 4:04:14 pm

just to add an alternative that would also make me happy:

The control slider (just one) should function more or less like a button. Pasting 6 keyframes every time. If it would work like this there would be in-betweens as well. But still the question remains... how can I do it.


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Filip Vandueren on May 9, 2019 at 6:11:41 pm

This works:

this is the expression that each of your six sliders should get, change the first line accordingly.
I have used a way of interpolating that will take into account the easing on your control-slider, so if you use eases or even hold-keyframes, that will all be reflect in the timing of the 6 controlled sliders.

myIndex = 1; // number of the slider.

sl=thisComp.layer("Null 1").effect("Slider Control")("Slider");

if (sl.numKeys>1 && time>sl.key(1).time && time<sl.key(sl.numKeys).time) {

nk = sl.nearestKey(time);
prevK = nk.time<time ? nk : sl.key(nk.index-1);
nextK = sl.key(prevK.index+1);

fromValue= (prevK.value == myIndex) ? 100 : 0;
toValue= (nextK.value == myIndex) ? 100 : 0;
if (prevK.value<nextK.value) {
linear(sl.value, prevK.value, nextK.value, fromValue, toValue);
} else {
linear(sl.value, nextK.value, prevK.value, toValue, fromValue);
}
} else {
sl.value == myIndex ? 100 : 0;
}





Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 9, 2019 at 6:32:20 pm

Haha Wauw! Filip! This works like a charm. Amazing work I must say!

I copied and pasted and... it works. Piece of art! Thank you very much Filip! It works very interactive now.

Would you like to explain your code a little? There is a lot of code I have no idea where it references to. Maybe I can learn from it.


Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Filip Vandueren on May 9, 2019 at 6:55:35 pm

Yes ☺

global remark: I've use "a ? b : c;" a few times, which is a javacsript shorthand for simple if/then/else statements:

if (a<10) { b= "smaller" } else { b = "larger" }

is the same as
b = (a<10) ? "smaller" : "larger";



myIndex = 1; // number of the slider. (this is used in the comparison below)

sl=thisComp.layer("Null 1").effect("Slider Control")("Slider");
// this is the controlling slider that rules 'em all.

// we want every slider to interpolate between 0 and 100
// but if the original slider is not animated (has 1 or no keyframes) or we are before or after the first/last keyframe
// then we shouldn't bother with calculating and just jump to the else{} statement
if (sl.numKeys>1 && time>sl.key(1).time && time<sl.key(sl.numKeys).time) {

nk = sl.nearestKey(time);
prevK = nk.time<time ? nk : sl.key(nk.index-1);
nextK = sl.key(prevK.index+1);
// this is just the kind of messy code you need to find out what is the previous and what is the next keyframe of the main slider at this point in time
// AE only has nearestKey() and that doesn't care if the nearest key is before or after this time.
// that's why we're checking if nk (nearestKey) of the slider is before or after the current time,

fromValue= (prevK.value == myIndex) ? 100 : 0;
toValue= (nextK.value == myIndex) ? 100 : 0;
// that's the main logic you needed: only my slider at full if that other slider points to "myIndex"
// We check if both the previous and the next keyframe are equal to "myIndex"

// Usually you would interpolate using the current time and the time of the keys
// But that would mean the interpolation is always linear() or ease(), depending on what we hardcode.
// Here I'm looking at the actual current value of the slider, and that tells me how fast it's going from it's previous keyframe's value to the next keyframes value, we map that to our two values (0 and 100 maybe)
// However: linear (or ease) expects its second parameter to always be smaller than the third, so I check with an if-then statement if that is the case, if it's not, I re-order them.
// linear (t, 10,0, 100,200) doesn't work -> linear (t, 0,10, 200,100) does work
if (prevK.value<nextK.value) {
linear(sl.value, prevK.value, nextK.value, fromValue, toValue);
} else {
linear(sl.value, nextK.value, prevK.value, toValue, fromValue);
}
// and we're done…


} else {
// or, if the slider is not animating; just check if its value == me.
sl.value == myIndex ? 100 : 0;
}





Re: Pose 2 Pose with ONE SLIDER controlling a Layer with Multiple Sliders (And therefore: keyframes)
by Wouter Dijkstra on May 9, 2019 at 7:15:21 pm

Hi Filip! Great that you explained so clearly. I must say I thought the thing I wanted was way easier (with the ValueAtTime thing, code I still 'can manage' ) But this is way more complex than I thought. I was able to pick up most of the code that you just taught me! Thanks for this.





© CreativeCOW.net