Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Move object between 3 different positions using slider control.

  • Move object between 3 different positions using slider control.

    Posted by Benjamin Taylor-day on July 4, 2013 at 7:20 pm

    Im currently working on an animation which includes having the characters ears go up and down depending on his expressions (happy/ sad etc).

    Ive currently managed to link both ears to a single slider that will move the ears up and down between 2 points: A: [2243.0,324.6] and B [2342.8,582.0], the code im using for this is:

    S=thisComp.layer(“Null 2”).effect(“Slider Control”)(“Slider”);
    A= [2243,324.6];
    B= [2342.8,582];
    linear(S,0,100,A,B)

    However i want to insert a 3rd point so when the slider is at 50 (half way) the ear will be at [2366.9,501.6].

    The code i tried was:

    S=thisComp.layer(“Null 2”).effect(“Slider Control”)(“Slider”);
    A= [2243,324.6];
    B= [2366.9,501.6];
    C= [2342.8,582];
    linear(S,0,100,A,B,C)

    But as i dont really understand what im saying there its not too surprising that the code didnt work.

    Anyhelp at all would be very grateful. Thanks 🙂

    Mike Roberts replied 11 years, 3 months ago 4 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    July 4, 2013 at 8:49 pm

    Try it this way:

    S=thisComp.layer(“Null 2”).effect(“Slider Control”)(“Slider”);
    A= [2243,324.6];
    B= [2366.9,501.6];
    C= [2342.8,582];
    if (S < 50)
    linear(S,0,50,A,B)
    else
    linear(S,50,100,B,C)

    Dan

  • Benjamin Taylor-day

    July 4, 2013 at 9:14 pm

    It works!!! Yaaaaaaay!

    Just to get my head around this for future reference…

    Your basically telling AE that when the slider is below 50 then make the scale 0-50 with points A and B at each end. When the slider is above 50 then the scale is 50-100 with points B and C at each end? When you put it that way its really simple!

    Thanks so much 🙂

  • Dan Ebberts

    July 4, 2013 at 9:24 pm

    I think you’ve got it.

    Dan

  • Mitch Mann

    July 8, 2013 at 1:49 pm

    … Or the poor man’s way:
    Animate it between 3 points in a preComp, then have the slider control the time remap.

  • Mike Roberts

    January 28, 2015 at 11:52 pm

    Hey! any idea how to add a fourth variable?

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