Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control Layer position by slider scale

  • Control Layer position by slider scale

    Posted by John Jackowiak on March 2, 2011 at 6:48 pm

    So this may seem like a dumb question, but I need to control a layers position from a slider scale. I can get it to work for a layers opacity based off a linear expression, but I can’t seem to get it to work the same for a layers x and y positions. For example

    Based off a slider scale of 0-100

    At zero, I need the later to be at position (50, 100)

    At 100, I need the layer to be a position (200, 400)

    Any ideas? Thanks!

    John Jackowiak
    Brand New Motion
    jo*******@***il.com

    ***Recent Work***

    https://brand-newmotion.com/reels/motion_graphics.mov

    Eduardo Asta replied 4 years ago 4 Members · 16 Replies
  • 16 Replies
  • Dan Ebberts

    March 2, 2011 at 7:45 pm

    Like this:

    slider = effect(“Slider Control”)(“Slider”);
    linear(slider,0,100,[50,100],[200,400])

    Dan

  • John Jackowiak

    March 3, 2011 at 8:32 pm

    Perfect. Thanks!

    John Jackowiak
    Brand New Motion
    johnj.bnm@gmail.com

    ***Recent Work***

    https://brand-newmotion.com/reels/motion_graphics.mov

  • John Jackowiak

    March 3, 2011 at 8:46 pm

    Actually one more question. If I wanted to add a 3rd (or more) positions, for higher values on the slider scale can it be written into the same expression? For example, at 200, position 3? I tried the following ways, but with no luck.

    slider = effect("Slider Control")("Slider");
    linear(slider,0,100,200[50,100],[200,400],[300,600])

    or

    slider = effect("Slider Control")("Slider");
    linear(slider,0,100,[50,100],[200,400])
    linear(slider,100,200,[200,400],[300,600])

    John Jackowiak
    Brand New Motion
    johnj.bnm@gmail.com

    ***Recent Work***

    https://brand-newmotion.com/reels/motion_graphics.mov

  • Dan Ebberts

    March 4, 2011 at 12:15 am

    I haven’t test it, but something like this should work:

    slider = effect(“Slider Control”)(“Slider”);
    if (slider < 100)
    linear(slider,0,100,[50,100],[200,400])
    else
    linear(slider,100,200,[200,400],[300,600])

    Dan

  • Caleb Power

    October 29, 2013 at 3:23 pm

    Hi Dan,

    You’ve helped me before and I really appreciate it.
    What you helped me with was telling each layer to grow to a certain size and opacity to go from 40% to 100% when a dot was with in a certain proximity of it. Not sure if you remember that or not. But I was wondering, instead of animating that dot manually, is there a way to use a slider control and just type in for example “1” and it’ll go to the position value of whatever that number is? I’d like to do the same with every number up to 7.

  • Dan Ebberts

    October 29, 2013 at 4:46 pm

    Hi Caleb,

    I can’t visualize what you’re asking. What “position value” are you talking about?

    Dan

  • Caleb Power

    October 29, 2013 at 4:58 pm

    Hey Dan.

    It’s the numbers 1 through 7 from left to right. The x position only will be effected. The dot will slide above each number and stop above each number. I want the position of each number to be known by the slider. So if I could somehow be able to type “1” for the position of the 1, and same for each other number.

  • Dan Ebberts

    October 29, 2013 at 5:22 pm

    If your target layer names are “1”, “2”, etc., something like this will give you the position of the one selected by a slider:

    layerName = “” + Math.round(effect(“Slider Control”)(“Slider”));
    thisComp.layer(layerName).transform.position

    Dan

  • Caleb Power

    October 29, 2013 at 6:37 pm

    I’m honestly not sure which layer to put that expression into. If I’m suppose to put it in the layers I want to be affected by the slider, I already have a bunch of code in those.. so I don’t know what to do in that case.

  • Dan Ebberts

    October 29, 2013 at 9:04 pm

    I’m sure what you want to do can be done, I just don’t have enough information to work from.

    Dan

Page 1 of 2

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