I want to make a Dorkly animation (

), that is, 8-bit puppets opening and closing their mouths. The difference I want to add is when the mouth is open the puppet get stretched (scaled) in the Y axis and when is closed the puppet returns to its original size. I have managed to get an automatic sync method so the problem now lies with the scale thing.

I've assigned a null that responds to the values adopted by the mouth so I ordered it when the mouth is open, stretch the puppet. To do this, I've used the following expression:

x=thisComp.layer("SIDE MOUTH GREEN").effect("LJ - visemes - MSD")("viseme nr.")
else if (x==3) [148,199];
else if (x==7) [148,199];
else if (x==10) [148,199];
else if (x==11) [148,199];
else [148,189];

The problem is as follows. When there are two consecutive sounds that are equivalent to an open mouth (FOR - GO - tten), the puppet doesn't move and that's a pretty dull stuff. What should be said to AF is: if after an open mouth value goes another open mouth value, on the changed value disable the stretching for X time. What'd be the expression that would be needed to achieve that?

I know I could do it manually but I want to broaden my skills.

  • Just a tip, try out the new(ish) character animator if you haven't already! I haven't, but it is built for this kind of thing.
    – Spencer
    Feb 7 '19 at 23:45
  • Also, could you just use the puppet tool and rig up some bones with DUIK? Does that achieve the look you're after? Then you shouldn't need expressions but can work with parenting (assuming I understand the question)
    – Spencer
    Feb 7 '19 at 23:47
  • First of all I wanted to share something I forgot to write in my previous message. Lars is a genius (vimeo.com/220359572) and has made an expression that allows the transfer of keyframes from CA (Character Animator) to AF and it works perfectly well. It saves you a lot of time. So, Spencer, I already have CA in my pocket ;P. Feb 8 '19 at 23:59
  • Stib, thanks for shortening it. I know little of expressions and my knowledge is based on what people post and my ability to understand and test what they post. Sorry for the mistakes I've made haha. (I've just put the expression and After Effects says "scaleYvals.IndexOf is not a function") Regarding the problem, what I wanted was to disable the stretching for a moment (for example 3-4 frames) and then enable it again. But, obviously, your solution is more logical because the shrinking should take place BEFORE the next open phoneme xd. In other words, it would look something like this: Feb 8 '19 at 23:59
  • The mouth opens and the puppet stretches. The next keyframe with an open phoneme is getting closer so the puppet shrinks. The keyframe has been reached and the puppet stretches again. As you have already said, this will be terribly difficult to set up, but as it is an action that is going to happen frequently, I wanted to automate it as much as possible. If you think it's too complicated and it's not worth making something up, it'll be done manually and we'll call it a day. Feb 8 '19 at 23:59

To shorten what you've already written you could pack all the open mouth values into an array and then find if the x value is in it:

var scaleYVals = [1 , 3, 7, 10, 11];
(scaleYVals.indexOf(x) > -1)? [148,199] : [148, 189];

The second line uses the ternary form of if (foo){bar} else {baz}, which can be written as (foo)? bar : baz. IndexOf returns the index of an element of an array, so if the value of x (bad name for a variable except if you're referring to an x coordinate, BTW) is 7 then indexOf will return 2. If the value is not in the array it returns -1

The problem with looking at the previous mouth shape is that you could still end up with no movement: say there was a sequence: open, open, closed. If you disable the stretching on the second open mouth you'll have the sequence stetched, unstretched, unstretched. It also greatly complicates the expression.

How about you make it so that the stretch happens at the beginning of the open mouth and then goes back briefly before the next phoneme?

Your Answer

