Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects expression linking distortion mesh positions to a slider

  • expression linking distortion mesh positions to a slider

    Posted by Mack Williams on January 13, 2009 at 4:19 pm

    I want the distortion mesh I’ve already animated on a layer to work with a slider. I can’t time remap the layer because it’s already a time remapped comp which I need to be able to change WHILE it is mesh warping… so I think I need to link the distortion mesh to a slider. For example, when the slider is at 2, I’d like the mesh to be a certain way, and when the slider is on 3, I’d like it to look a different way. I can’t figure out how to add and expression to distortion mesh. Is it even possible?

    I already wrote an expression that would do this for position and I’d like to change it to work with distortion mesh…

    if (thisComp.layer(“HEAD TURN”).effect(“Slider Control”)(“Slider”) == 0){
    DISTORTION MESH DATA 0;}
    else if (thisComp.layer(“HEAD TURN”).effect(“Slider Control”)(“Slider”) == 1){
    DISTORTION MESH DATA 1;}
    else if (thisComp.layer(“HEAD TURN”).effect(“Slider Control”)(“Slider”) == 2){
    DISTORTION MESH DATA 2;}
    else if (thisComp.layer(“HEAD TURN”).effect(“Slider Control”)(“Slider”) == 3){
    DISTORTION MESH DATA 3;}

    I just don’t know where to find the distortion mesh data or set an expression on distortion mesh. Anyone got any ideas?

    Mack Williams replied 17 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Elad Menashe

    January 13, 2009 at 9:37 pm

    If I understand you correctly you shouldn’t do this with expressions.
    In order to change the time it takes to transition from one mesh to another you should move the Distortion Mesh keyframes in the timeline.
    For example: if you have keyframes A & B which are one second apart, moving B closer to A will make the mesh to change more rapidly. This is done without affecting the mesh, you only move the keyframes in the timeline.

    This can be solved with expressions but it’s cumbersome.

    Regards,
    Elad

  • Mack Williams

    January 13, 2009 at 9:56 pm

    Thanks, but it’s a little more complicated than that. I realized later that my first post didn’t do a very good job explaining what I needed to do.

    Anyway, I finally figured it out, but you’re right. It was very cumbersome. I am animating a character’s head. The expression I wrote was over 300 lines. It basically told the comp which frame of a mouth comp to show based on which direction the characters head was facing and how wide open their mouth was (which was determined by sliders on null objects). I had to create a frame that corresponded to every possible combination of face direction and mouth shape. 8 mouth shapes and 18 face directions. Then I precomped and time remapped that layer and applied my expression.

    M = timeToFrames(thisComp.layer(“mouth MSTR”).timeRemap)
    H = timeToFrames(thisComp.layer(“Head FULL”).timeRemap)

    if (M == 0 && H==0){
    framesToTime(0);}
    else if (M == 1 && H==0){
    framesToTime(20);}
    else if (M == 2 && H==0){
    framesToTime(40);}
    else if (M == 3 && H==0){
    framesToTime(60);}
    else if (M == 4 && H==0){
    framesToTime(80);}
    else if (M == 5 && H==0){
    framesToTime(100);}
    else if (M == 6 && H==0){
    framesToTime(120);}
    else if (M == 7 && H==0){
    framesToTime(140);}

    if (M == 0 && H==1){
    framesToTime(0+1);}
    else if (M == 1 && H==1){
    framesToTime(20+1);}
    else if (M == 2 && H==1){
    framesToTime(40+1);}
    else if (M == 3 && H==1){
    framesToTime(60+1);}
    else if (M == 4 && H==1){
    framesToTime(80+1);}
    else if (M == 5 && H==1){
    framesToTime(100+1);}
    else if (M == 6 && H==1){
    framesToTime(120+1);}
    else if (M == 7 && H==1){
    framesToTime(140+1);}

    …and so on, all the way through 18 face positions. I was very excited to get it to work, because even though it took me a long time to set up, it will save me hours of time going forward with this project!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy