Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Link position value to frame number

  • Link position value to frame number

    Posted by Patrick Murphy on March 3, 2014 at 9:32 pm

    Hello helpful folks!

    I’m trying to make a chin on a character move to certain mouths on a time remapped layer.

    How would I start this?
    I want to have 3 different frames from a time remapped layer move the position of a chin layer slightly down then the other frames move it back up to the original position.

    Im guessing I would put the expression on the position of the chin layer, telling it to move when the remapped mouth layer hits certain frames. Ie. be in position x at frames 2, 4, 6 and be at position y at frames 1, 3, 5.

    Any help is always much appreciated. Thanks!

    Patrick Murphy replied 12 years, 2 months ago 2 Members · 7 Replies
  • 7 Replies
  • Patrick Murphy

    March 3, 2014 at 9:52 pm

    Here’s what I’ve gotten so far….

    I put this on the position of my chin layer:

    A = framesToTime(thisComp.layer(“Mouths.mov”).timeRemap);
    B = [377.5, 606.0]; // chin down
    C = [377.5, 597.0]; // chin up

    if (A == 7){B;} else{C;}

  • Dan Ebberts

    March 3, 2014 at 10:24 pm

    The timeRemap value is going to be in seconds, so I think you’ll need to use timeToFrames() instead.

    Dan

  • Patrick Murphy

    March 3, 2014 at 11:02 pm

    That worked but say I want more than just one frame to move the position, would I add an array? Or is there some way of bracketing that says if the value is one of these numbers then B?

    A = timeToFrames(thisComp.layer(“Mouths.mov”).timeRemap);
    B = [377.5, 606.0]; //chin down
    C = [377.5, 597.0]; //chin up
    D = [2,3,6,9}; //frames to move chin down

    if (A == D){B;}else{C;}

    Thanks so much for your help.

  • Dan Ebberts

    March 3, 2014 at 11:12 pm

    This would be one way (not tested):


    A = timeToFrames(thisComp.layer("Mouths.mov").timeRemap);
    B = [377.5, 606.0]; //chin down
    C = [377.5, 597.0]; //chin up
    D = [2,3,6,9]; //frames to move chin down

    val = C;
    for (i = 0; i < D.length; i++){
    if (A == D[i]){
    val = B;
    break;
    }
    }
    val

    Dan

  • Patrick Murphy

    March 3, 2014 at 11:25 pm

    It works, you are the man!

    Does that mean your turning the values in D to 0 and if it’s not 0 then use C?

    I’m just trying to understand it. Thanks for your patience.

  • Dan Ebberts

    March 3, 2014 at 11:31 pm

    No, the last part assumes the result (val) will be C, but then it loops through array D, looking for a match. If it finds one, it uses B instead.

    Dan

  • Patrick Murphy

    March 3, 2014 at 11:45 pm

    Thank you!!!

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