-
Animating Mouth Movement with Wiggle
I’m trying to animate the mouth movement of a character I’ve photoshopped. I know how to do this with the wiggle expression, but I’m trying to add an if/else statement that stops the movement from going any higher than a certain point, so that the mouth doesn’t move too far up the face.
The code I’m trying to use right now is:
w = wiggle(5,thisComp.layer("Mouth Slider").effect("Slider Control")("Slider"));if(transform.position[1] > 474) [value[0], w[1], value[2]] else [value[0], valueAtTime(time)[1]+1, value[2]];
I’m fairly new to using expressions, but my thinking is that if the mouth is greater than the default “closed” position at y=474, then it will wiggle, but if that wiggle moves the mouth’s position to less than 474, it will stop wiggling and instead take the value at the current time and add 1 to it, which I thought would push the position back to 475, which would then restart the wiggle.
I think I’ve found a simpler way to animate this using a null layer, but I’m still curious to know if the logic I’ve used here is possible to code or whether it would be a lot more complex than this.
Any help is appreciated, thanks!