Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Translating X position data to -100 to 100 slider range

  • Translating X position data to -100 to 100 slider range

    Posted by Vanessa Appleby on November 7, 2015 at 7:22 pm

    I have a slider (actual artwork that is a slider) that is part of a graph. It needs to be controlled by an expression control slider with value range of -100 to +100 (-100 is the far left of the slider art, +100 is far right). here’s a picture

    The triangle needs to move across the slider as the value changes. Super simple.

    I can’t figure out how to translate the position values of the start and the end points to the -100 to 100 value range of the expression slider. In this comp the start X position value is 0, and the end value is 800. So somehow I need to define the following:

    -100 (slider range) = 0 (x position)
    +100 (slider range) = 800 (x position)

    This is probably simple math, but well, I never paid much attention in math class- too busy drawing! Any help would be GREATLY appreciated. Thanks!

    Dan Ebberts replied 10 years, 9 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    November 7, 2015 at 7:28 pm

    It should be something like this:

    s = (your slider reference here);
    x = linear(s,-100,100,0,800);
    [x,value[1]]

    Dan

  • Vanessa Appleby

    November 7, 2015 at 7:44 pm

    YOU ARE A GENIUS! This works perfectly! Thanks soooo much!

  • Vanessa Appleby

    November 7, 2015 at 7:57 pm

    Nevermind. I got it. here it is for Y in case anyone else needs this:

    s = thisComp.layer(“VALUES”).effect(“Value1”)(“Slider”);
    y = linear(s,-100,100,0,800);
    [value[1],y]

  • Dan Ebberts

    November 7, 2015 at 8:01 pm

    try changing the last line to:

    [value[0],y]

    Dan

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