Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change a layer’s position based on Slider

  • Change a layer’s position based on Slider

    Posted by Patrick O’callaghan on July 1, 2015 at 3:29 pm

    Hi all,

    I hope you can help me, I only have a passing knowledge of expression and I’m struggling to make this work:

    I have a character ready for animation, the torso is a time remap of instances so we get a full turnaround, said instances are controlled by a slider:

    sliderPos = thisComp.layer(“B_CHEST”).effect(“BODY POSES”)(“Slider”);
    framesToTime((Math.round(sliderPos)))

    So as to equate the time remap values to the slider (it’s an expression that I found that Dan Ebbert made)

    Now, my struggle is in trying to re-position the top of the arm to match the change in the torso. I’d like to use specific x,y coordinates on the arm for each instance of the time remap.

    Any help is greatly appreciated,
    Best Regards

    Patrick O’callaghan replied 10 years, 10 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 1, 2015 at 6:47 pm

    I haven’t tested this, but it will probably be something like this:

    sliderPos = thisComp.layer(“B_CHEST”).effect(“BODY POSES”)(“Slider”);
    posArray = [[200,220],[210,220],[230,221],[235,220]];
    idx = Math.min(Math.round(sliderPos),posArray.length-1);
    posArray[idx]

    where posArray is your list of positions corresponding to each frame.

    Dan

  • Peter Diefenthaler

    July 1, 2015 at 7:03 pm

    Whoops, Dan beat me to the punch. Anyway, this method works also, but probably isn’t as elegant of a solution.

    sliderPos = Math.round(thisComp.layer("B_CHEST").effect("BODY POSES")("Slider"));
    switch(sliderPos){
    case 1:
    [x,y];
    break;
    case 2:
    [x,y];
    break;
    case 3:
    [x,y];
    break;
    default:
    value;
    }

    Peter Diefenthaler
    https://www.ideafirecreative.com/

  • Patrick O’callaghan

    July 2, 2015 at 10:33 am

    That’s great Dan, it works perfectly, thanks very much for your help! really appreciate it! 🙂

    Cheers!

  • Patrick O’callaghan

    July 2, 2015 at 10:34 am

    Cheers Peter! thanks for your help, both good solutions!

    Thanks! 🙂
    Patrick

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