Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Position slider expression

  • Position slider expression

    Posted by Morgan Williams on September 25, 2013 at 1:35 pm

    Hi all,
    New to expressions and this forum, but old to AE. ; )

    I’m looking for a code for the position property that would allow a slider with a 0-100 range to drive that property so that:

    0 = value x
    50 = value y
    100 = value z

    and x, y and z do not have to be necessarily sequential.

    Any thoughts?
    Much appreciated!
    M

    Morgan Williams replied 12 years, 12 months ago 2 Members · 6 Replies
  • 6 Replies
  • Morgan Williams

    September 25, 2013 at 2:30 pm

    BTW, I’m using split position properties so these only need to be single number values…

  • Darby Edelen

    September 25, 2013 at 9:33 pm

    Do you need the return value to change as the input ranges from 0 to 50 and 50 to 100 or do you want them to snap as the input value reaches each threshold?

    Darby Edelen

  • Morgan Williams

    September 25, 2013 at 9:42 pm

    I need the value to change.

  • Morgan Williams

    September 25, 2013 at 10:19 pm

    Sorry that was sort of an incomplete sentence, I need the return values to change as the slider moves between the 0, 50, 100 inputs.
    Thx

  • Darby Edelen

    September 25, 2013 at 11:57 pm

    Something like this applied to the position property should work.

    slider = effect("Slider Control")(1);
    x = [300, 600];
    y = [500, 300];
    z = [800, 700];

    if(slider < 50) linear(slider, 0, 50, x, y);
    else linear(slider, 50, 100, y, z);

    Darby Edelen

  • Morgan Williams

    September 26, 2013 at 12:30 pm

    That works great! Thank you so much.

    I’m working on what I hope will be a really fun and fancy character rig. I’ll post a link to the file when/if I finish it successfully so you can see how I used the code. I plan the share the rig with my students and anyone else interested.

    If you don’t mind I’ll include a little note of acknowledgment crediting you with help on the coding. I for sure couldn’t have figured that one out on my own.

    Again, many thanks!

    M

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